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

// --- FUN_00460030 at 0x00460030 (size: 44) ---


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



{

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

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

  *(undefined4 *)(param_1 + 0x54c) = param_4;

  FUN_0045ad00();

  return;

}





// --- FUN_00460060 at 0x00460060 (size: 36) ---


void __fastcall FUN_00460060(int param_1)



{

  *(undefined4 *)(param_1 + 0x550) = DAT_0083e1c8;

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

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

  FUN_0045ad00();

  return;

}





// --- FUN_00460090 at 0x00460090 (size: 49) ---


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



{

  undefined4 uVar1;

  

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

    return 0;

  }

  uVar1 = FUN_006948f0();

  *param_2 = uVar1;

  uVar1 = FUN_00694910();

  *param_3 = uVar1;

  return 1;

}





// --- FUN_004600d0 at 0x004600D0 (size: 52) ---


void __thiscall FUN_004600d0(int *param_1,int param_2,int param_3)



{

  int iVar1;

  int iVar2;

  

  iVar1 = *param_1;

  iVar2 = FUN_0069fe70();

  iVar2 = FUN_0069fe60(param_3 - iVar2 / 2);

  (**(code **)(iVar1 + 0x2c))(param_2 - iVar2 / 2);

  return;

}





// --- FUN_00460110 at 0x00460110 (size: 106) ---


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



{

  int iVar1;

  int iVar2;

  int iVar3;

  int local_10 [4];

  

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

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

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

  if (param_2 != local_10) {

    param_2[2] = *(int *)(param_1 + 0x254) + -1 + iVar2;

    *param_2 = iVar2;

    param_2[1] = iVar1;

    param_2[3] = iVar3 + -1 + iVar1;

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

    return;

  }

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

  return;

}





// --- FUN_00460180 at 0x00460180 (size: 65) ---


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



{

  if (param_2 != (undefined4 *)(param_1 + 0x7c)) {

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

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

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

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

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

    return;

  }

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

  return;

}





// --- FUN_004601d0 at 0x004601D0 (size: 13) ---


uint __fastcall FUN_004601d0(int param_1)



{

  return *(uint *)(param_1 + 0x554) >> 0xe & 1;

}





// --- FUN_004601e0 at 0x004601E0 (size: 106) ---


void __thiscall FUN_004601e0(int *param_1,byte param_2)



{

  int iVar1;

  int iVar2;

  

  param_1[0x155] = param_1[0x155] ^ ((uint)param_2 << 0x15 ^ param_1[0x155]) & 0x200000;

  iVar1 = *(int *)(DAT_0083e03c + 0x9c);

  iVar2 = (**(code **)(*param_1 + 0xa0))();

  if (iVar2 == iVar1) {

    if (param_2 == 0) {

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

      return;

    }

  }

  else if (param_2 != 0) {

    (**(code **)(*param_1 + 0x44))(iVar1);

  }

  return;

}





// --- FUN_00460250 at 0x00460250 (size: 18) ---


void __fastcall FUN_00460250(undefined4 param_1)



{

  if (DAT_0083e03c != 0) {

    FUN_0045b350(param_1);

  }

  return;

}





// --- FUN_00460270 at 0x00460270 (size: 26) ---


void FUN_00460270(undefined4 param_1,undefined4 param_2)



{

  if (DAT_0083e03c != 0) {

    FUN_0045d310(param_1,param_2);

  }

  return;

}





// --- FUN_00460290 at 0x00460290 (size: 39) ---


undefined4 __fastcall FUN_00460290(int param_1)



{

  char cVar1;

  

  if ((*(uint *)(param_1 + 0x554) >> 7 & 1) == 0) {

    cVar1 = FUN_0042ce00(1);

    if (cVar1 == '\0') {

      return 0;

    }

  }

  return 1;

}





// --- FUN_004602c0 at 0x004602C0 (size: 69) ---


bool __fastcall FUN_004602c0(int param_1)



{

  int iVar1;

  bool bVar2;

  

  iVar1 = FUN_0045fb30();

  if (iVar1 != 0) {

    *(uint *)(param_1 + 0x554) = *(uint *)(param_1 + 0x554) | 0x400000;

    bVar2 = (*(uint *)(iVar1 + 0x554) >> 0x14 & 1) != 0;

    if (bVar2) {

      FUN_0045b970(param_1);

    }

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

    return bVar2;

  }

  return false;

}





// --- FUN_00460310 at 0x00460310 (size: 30) ---


undefined4 __fastcall FUN_00460310(int param_1)



{

  if (DAT_0083e03c != 0) {

    return CONCAT31((int3)((uint)DAT_0083e03c >> 8),*(int *)(DAT_0083e03c + 0x328) == param_1);

  }

  return 0;

}





// --- FUN_00460330 at 0x00460330 (size: 7) ---


undefined4 __fastcall FUN_00460330(int param_1)



{

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

}





// --- FUN_00460340 at 0x00460340 (size: 48) ---


void __fastcall FUN_00460340(int *param_1)



{

  char cVar1;

  

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

    cVar1 = (**(code **)(*param_1 + 0x124))();

    if (cVar1 == '\0') {

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

      return;

    }

  }

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

  return;

}





// --- FUN_004603a0 at 0x004603A0 (size: 110) ---


uint __fastcall FUN_004603a0(int *param_1)



{

  int *piVar1;

  int *piVar2;

  int *piVar3;

  byte bVar4;

  uint uVar5;

  

  if (DAT_0083e03c == 0) {

    return 0;

  }

  piVar1 = *(int **)(DAT_0083e03c + 0x9c);

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

    return DAT_0083e03c & 0xffffff00;

  }

  piVar3 = (int *)(**(code **)(*param_1 + 0xa0))();

  uVar5 = (uint)param_1[0x29] >> 1;

  bVar4 = (byte)uVar5;

  while( true ) {

    piVar2 = piVar3;

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

      return 0;

    }

    if (piVar2 == (int *)0x0) break;

    uVar5 = (uint)piVar2[0x29] >> 1;

    bVar4 = (byte)uVar5;

    piVar3 = (int *)(**(code **)(*piVar2 + 0xa0))();

    param_1 = piVar2;

  }

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

    return 0;

  }

  if (param_1 != piVar1) {

    return 0;

  }

  return 1;

}





// --- FUN_00460410 at 0x00460410 (size: 89) ---


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



{

  undefined4 local_28;

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

  

  local_28 = *(undefined4 *)(param_1 + 0x2e4);

  local_20 = param_2;

  local_18 = param_4;

  local_1c = param_3;

  local_4 = 0;

  local_14 = 0;

  local_10 = 0;

  local_c = 0;

  local_8 = 0;

  if (DAT_0083e03c != 0) {

    local_24 = param_1;

    FUN_0045ac50(&local_28);

  }

  return;

}





// --- FUN_00460470 at 0x00460470 (size: 177) ---


undefined1 __thiscall FUN_00460470(int *param_1,undefined4 param_2,undefined4 param_3)



{

  int iVar1;

  char cVar2;

  undefined1 local_9;

  undefined4 *local_8;

  int *local_4;

  

  local_9 = 0;

  local_8 = (undefined4 *)0x0;

  local_4 = (int *)0x0;

  cVar2 = FUN_0042a2d0(param_2);

  if ((cVar2 != '\0') && (local_4 != (int *)0x0)) {

    FUN_00429b10();

    cVar2 = (**(code **)(*local_4 + 0xac))(param_3);

    if (cVar2 != '\0') {

      cVar2 = (**(code **)(*param_1 + 0xd4))(&local_8);

      if (cVar2 != '\0') {

        local_9 = 1;

      }

    }

  }

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

    iVar1 = local_8[1];

    local_8[1] = iVar1 + -1;

    if (iVar1 + -1 == 0) {

      (**(code **)*local_8)(1);

    }

    local_8 = (undefined4 *)0x0;

  }

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

    iVar1 = local_4[1];

    local_4[1] = iVar1 + -1;

    if (iVar1 + -1 == 0) {

      (**(code **)*local_4)(1);

    }

  }

  return local_9;

}





// --- FUN_00460530 at 0x00460530 (size: 177) ---


undefined1 __thiscall FUN_00460530(int *param_1,undefined4 param_2,undefined4 param_3)



{

  int iVar1;

  char cVar2;

  undefined1 local_9;

  undefined4 *local_8;

  int *local_4;

  

  local_9 = 0;

  local_8 = (undefined4 *)0x0;

  local_4 = (int *)0x0;

  cVar2 = FUN_0042a2d0(param_2);

  if ((cVar2 != '\0') && (local_4 != (int *)0x0)) {

    FUN_00429b10();

    cVar2 = (**(code **)(*local_4 + 0xcc))(param_3);

    if (cVar2 != '\0') {

      cVar2 = (**(code **)(*param_1 + 0xd4))(&local_8);

      if (cVar2 != '\0') {

        local_9 = 1;

      }

    }

  }

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

    iVar1 = local_8[1];

    local_8[1] = iVar1 + -1;

    if (iVar1 + -1 == 0) {

      (**(code **)*local_8)(1);

    }

    local_8 = (undefined4 *)0x0;

  }

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

    iVar1 = local_4[1];

    local_4[1] = iVar1 + -1;

    if (iVar1 + -1 == 0) {

      (**(code **)*local_4)(1);

    }

  }

  return local_9;

}





// --- FUN_004605f0 at 0x004605F0 (size: 190) ---


undefined1 __thiscall FUN_004605f0(int *param_1,undefined4 param_2)



{

  int iVar1;

  char cVar2;

  undefined1 local_9;

  undefined4 *local_8;

  int *local_4;

  

  local_9 = 0;

  local_8 = (undefined4 *)0x0;

  local_4 = (int *)0x0;

  cVar2 = FUN_0042a2d0(param_2);

  if ((cVar2 != '\0') && (local_4 != (int *)0x0)) {

    FUN_00429b10();

    cVar2 = (**(code **)(*local_4 + 0xc4))(&stack0x00000008);

    if (cVar2 != '\0') {

      cVar2 = (**(code **)(*param_1 + 0xd4))(&local_8);

      if (cVar2 != '\0') {

        local_9 = 1;

      }

    }

  }

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

    iVar1 = local_8[1];

    local_8[1] = iVar1 + -1;

    if (iVar1 + -1 == 0) {

      (**(code **)*local_8)(1);

    }

    local_8 = (undefined4 *)0x0;

  }

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

    iVar1 = local_4[1];

    local_4[1] = iVar1 + -1;

    if (iVar1 + -1 == 0) {

      (**(code **)*local_4)(1);

    }

    local_4 = (int *)0x0;

  }

  FUN_0042e590();

  return local_9;

}





// --- FUN_004606b0 at 0x004606B0 (size: 174) ---


undefined1 __thiscall FUN_004606b0(int *param_1,undefined4 param_2,undefined4 param_3)



{

  int iVar1;

  char cVar2;

  undefined1 local_9;

  undefined4 *local_8;

  int *local_4;

  

  local_9 = 0;

  local_8 = (undefined4 *)0x0;

  local_4 = (int *)0x0;

  cVar2 = FUN_0042a2d0(param_2);

  if ((cVar2 != '\0') && (local_4 != (int *)0x0)) {

    FUN_00429b10();

    cVar2 = (**(code **)(*local_4 + 0x7c))(param_3);

    if (cVar2 != '\0') {

      cVar2 = (**(code **)(*param_1 + 0xd4))(&local_8);

      if (cVar2 != '\0') {

        local_9 = 1;

      }

    }

  }

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

    iVar1 = local_8[1];

    local_8[1] = iVar1 + -1;

    if (iVar1 + -1 == 0) {

      (**(code **)*local_8)(1);

    }

    local_8 = (undefined4 *)0x0;

  }

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

    iVar1 = local_4[1];

    local_4[1] = iVar1 + -1;

    if (iVar1 + -1 == 0) {

      (**(code **)*local_4)(1);

    }

  }

  return local_9;

}





// --- FUN_00460760 at 0x00460760 (size: 177) ---


undefined1 __thiscall FUN_00460760(int *param_1,undefined4 param_2,undefined4 param_3)



{

  int iVar1;

  char cVar2;

  undefined1 local_9;

  undefined4 *local_8;

  int *local_4;

  

  local_9 = 0;

  local_8 = (undefined4 *)0x0;

  local_4 = (int *)0x0;

  cVar2 = FUN_0042a2d0(param_2);

  if ((cVar2 != '\0') && (local_4 != (int *)0x0)) {

    FUN_00429b10();

    cVar2 = (**(code **)(*local_4 + 0x8c))(param_3);

    if (cVar2 != '\0') {

      cVar2 = (**(code **)(*param_1 + 0xd4))(&local_8);

      if (cVar2 != '\0') {

        local_9 = 1;

      }

    }

  }

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

    iVar1 = local_8[1];

    local_8[1] = iVar1 + -1;

    if (iVar1 + -1 == 0) {

      (**(code **)*local_8)(1);

    }

    local_8 = (undefined4 *)0x0;

  }

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

    iVar1 = local_4[1];

    local_4[1] = iVar1 + -1;

    if (iVar1 + -1 == 0) {

      (**(code **)*local_4)(1);

    }

  }

  return local_9;

}





// --- FUN_00460820 at 0x00460820 (size: 174) ---


undefined1 __thiscall FUN_00460820(int *param_1,undefined4 param_2,undefined4 param_3)



{

  int iVar1;

  char cVar2;

  undefined1 local_9;

  undefined4 *local_8;

  int *local_4;

  

  local_9 = 0;

  local_8 = (undefined4 *)0x0;

  local_4 = (int *)0x0;

  cVar2 = FUN_0042a2d0(param_2);

  if ((cVar2 != '\0') && (local_4 != (int *)0x0)) {

    FUN_00429b10();

    cVar2 = (**(code **)(*local_4 + 0x74))(param_3);

    if (cVar2 != '\0') {

      cVar2 = (**(code **)(*param_1 + 0xd4))(&local_8);

      if (cVar2 != '\0') {

        local_9 = 1;

      }

    }

  }

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

    iVar1 = local_8[1];

    local_8[1] = iVar1 + -1;

    if (iVar1 + -1 == 0) {

      (**(code **)*local_8)(1);

    }

    local_8 = (undefined4 *)0x0;

  }

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

    iVar1 = local_4[1];

    local_4[1] = iVar1 + -1;

    if (iVar1 + -1 == 0) {

      (**(code **)*local_4)(1);

    }

  }

  return local_9;

}





// --- FUN_004608d0 at 0x004608D0 (size: 177) ---


undefined1 __thiscall FUN_004608d0(int *param_1,undefined4 param_2,undefined4 param_3)



{

  int iVar1;

  char cVar2;

  undefined1 local_9;

  undefined4 *local_8;

  int *local_4;

  

  local_9 = 0;

  local_8 = (undefined4 *)0x0;

  local_4 = (int *)0x0;

  cVar2 = FUN_0042a2d0(param_2);

  if ((cVar2 != '\0') && (local_4 != (int *)0x0)) {

    FUN_00429b10();

    cVar2 = (**(code **)(*local_4 + 0xb4))(param_3);

    if (cVar2 != '\0') {

      cVar2 = (**(code **)(*param_1 + 0xd4))(&local_8);

      if (cVar2 != '\0') {

        local_9 = 1;

      }

    }

  }

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

    iVar1 = local_8[1];

    local_8[1] = iVar1 + -1;

    if (iVar1 + -1 == 0) {

      (**(code **)*local_8)(1);

    }

    local_8 = (undefined4 *)0x0;

  }

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

    iVar1 = local_4[1];

    local_4[1] = iVar1 + -1;

    if (iVar1 + -1 == 0) {

      (**(code **)*local_4)(1);

    }

  }

  return local_9;

}





// --- FUN_00460990 at 0x00460990 (size: 198) ---


uint __thiscall FUN_00460990(int *param_1,undefined4 param_2)



{

  int iVar1;

  char cVar2;

  undefined4 *unaff_EBX;

  uint unaff_ESI;

  undefined4 *unaff_retaddr;

  int *piStack_c;

  undefined4 local_8;

  undefined4 local_4;

  

  piStack_c = (int *)(uint)(uint3)piStack_c;

  local_8 = 0;

  local_4 = 0;

  cVar2 = (**(code **)(*param_1 + 0xd0))(param_2,&local_8);

  if (cVar2 == '\0') {

    cVar2 = FUN_0042a2d0(param_2);

    if (((cVar2 == '\0') || (piStack_c == (int *)0x0)) ||

       (cVar2 = (**(code **)(*piStack_c + 0xa8))(unaff_retaddr), cVar2 == '\0')) {

      *unaff_retaddr = 0;

    }

  }

  else if ((piStack_c != (int *)0x0) &&

          (cVar2 = (**(code **)(*piStack_c + 0xa8))(unaff_retaddr), cVar2 != '\0')) {

    unaff_ESI = 0x1000000;

  }

  if ((unaff_EBX != (undefined4 *)0x0) &&

     (iVar1 = unaff_EBX[1], unaff_EBX[1] = iVar1 + -1, iVar1 + -1 == 0)) {

    (**(code **)*unaff_EBX)(1);

  }

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

     (iVar1 = piStack_c[1], piStack_c[1] = iVar1 + -1, iVar1 + -1 == 0)) {

    (**(code **)*piStack_c)(1);

  }

  return unaff_ESI >> 0x18;

}





// --- FUN_00460a60 at 0x00460A60 (size: 198) ---


uint __thiscall FUN_00460a60(int *param_1,undefined4 param_2)



{

  int iVar1;

  char cVar2;

  undefined4 *unaff_EBX;

  uint unaff_ESI;

  undefined4 *unaff_retaddr;

  int *piStack_c;

  undefined4 local_8;

  undefined4 local_4;

  

  piStack_c = (int *)(uint)(uint3)piStack_c;

  local_8 = 0;

  local_4 = 0;

  cVar2 = (**(code **)(*param_1 + 0xd0))(param_2,&local_8);

  if (cVar2 == '\0') {

    cVar2 = FUN_0042a2d0(param_2);

    if (((cVar2 == '\0') || (piStack_c == (int *)0x0)) ||

       (cVar2 = (**(code **)(*piStack_c + 200))(unaff_retaddr), cVar2 == '\0')) {

      *unaff_retaddr = 0;

    }

  }

  else if ((piStack_c != (int *)0x0) &&

          (cVar2 = (**(code **)(*piStack_c + 200))(unaff_retaddr), cVar2 != '\0')) {

    unaff_ESI = 0x1000000;

  }

  if ((unaff_EBX != (undefined4 *)0x0) &&

     (iVar1 = unaff_EBX[1], unaff_EBX[1] = iVar1 + -1, iVar1 + -1 == 0)) {

    (**(code **)*unaff_EBX)(1);

  }

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

     (iVar1 = piStack_c[1], piStack_c[1] = iVar1 + -1, iVar1 + -1 == 0)) {

    (**(code **)*piStack_c)(1);

  }

  return unaff_ESI >> 0x18;

}





// --- FUN_00460b30 at 0x00460B30 (size: 192) ---


uint __thiscall FUN_00460b30(int *param_1,undefined4 param_2)



{

  int iVar1;

  char cVar2;

  undefined4 *unaff_EBX;

  uint unaff_ESI;

  undefined4 *unaff_retaddr;

  int *piStack_c;

  undefined4 local_8;

  undefined4 local_4;

  

  piStack_c = (int *)(uint)(uint3)piStack_c;

  local_8 = 0;

  local_4 = 0;

  cVar2 = (**(code **)(*param_1 + 0xd0))(param_2,&local_8);

  if (cVar2 == '\0') {

    cVar2 = FUN_0042a2d0(param_2);

    if (((cVar2 == '\0') || (piStack_c == (int *)0x0)) ||

       (cVar2 = (**(code **)(*piStack_c + 0x78))(unaff_retaddr), cVar2 == '\0')) {

      *unaff_retaddr = 0;

    }

  }

  else if ((piStack_c != (int *)0x0) &&

          (cVar2 = (**(code **)(*piStack_c + 0x78))(unaff_retaddr), cVar2 != '\0')) {

    unaff_ESI = 0x1000000;

  }

  if ((unaff_EBX != (undefined4 *)0x0) &&

     (iVar1 = unaff_EBX[1], unaff_EBX[1] = iVar1 + -1, iVar1 + -1 == 0)) {

    (**(code **)*unaff_EBX)(1);

  }

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

     (iVar1 = piStack_c[1], piStack_c[1] = iVar1 + -1, iVar1 + -1 == 0)) {

    (**(code **)*piStack_c)(1);

  }

  return unaff_ESI >> 0x18;

}





// --- FUN_00460bf0 at 0x00460BF0 (size: 198) ---


uint __thiscall FUN_00460bf0(int *param_1,undefined4 param_2)



{

  int iVar1;

  char cVar2;

  undefined4 *unaff_EBX;

  uint unaff_ESI;

  undefined4 *unaff_retaddr;

  int *piStack_c;

  undefined4 local_8;

  undefined4 local_4;

  

  piStack_c = (int *)(uint)(uint3)piStack_c;

  local_8 = 0;

  local_4 = 0;

  cVar2 = (**(code **)(*param_1 + 0xd0))(param_2,&local_8);

  if (cVar2 == '\0') {

    cVar2 = FUN_0042a2d0(param_2);

    if (((cVar2 == '\0') || (piStack_c == (int *)0x0)) ||

       (cVar2 = (**(code **)(*piStack_c + 0x88))(unaff_retaddr), cVar2 == '\0')) {

      *unaff_retaddr = 0;

    }

  }

  else if ((piStack_c != (int *)0x0) &&

          (cVar2 = (**(code **)(*piStack_c + 0x88))(unaff_retaddr), cVar2 != '\0')) {

    unaff_ESI = 0x1000000;

  }

  if ((unaff_EBX != (undefined4 *)0x0) &&

     (iVar1 = unaff_EBX[1], unaff_EBX[1] = iVar1 + -1, iVar1 + -1 == 0)) {

    (**(code **)*unaff_EBX)(1);

  }

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

     (iVar1 = piStack_c[1], piStack_c[1] = iVar1 + -1, iVar1 + -1 == 0)) {

    (**(code **)*piStack_c)(1);

  }

  return unaff_ESI >> 0x18;

}





// --- FUN_00460cc0 at 0x00460CC0 (size: 192) ---


uint __thiscall FUN_00460cc0(int *param_1,undefined4 param_2)



{

  int iVar1;

  char cVar2;

  undefined4 *unaff_EBX;

  uint unaff_ESI;

  undefined1 *unaff_retaddr;

  int *piStack_c;

  undefined4 local_8;

  undefined4 local_4;

  

  piStack_c = (int *)(uint)(uint3)piStack_c;

  local_8 = 0;

  local_4 = 0;

  cVar2 = (**(code **)(*param_1 + 0xd0))(param_2,&local_8);

  if (cVar2 == '\0') {

    cVar2 = FUN_0042a2d0(param_2);

    if (((cVar2 == '\0') || (piStack_c == (int *)0x0)) ||

       (cVar2 = (**(code **)(*piStack_c + 0x70))(unaff_retaddr), cVar2 == '\0')) {

      *unaff_retaddr = 0;

    }

  }

  else if ((piStack_c != (int *)0x0) &&

          (cVar2 = (**(code **)(*piStack_c + 0x70))(unaff_retaddr), cVar2 != '\0')) {

    unaff_ESI = 0x1000000;

  }

  if ((unaff_EBX != (undefined4 *)0x0) &&

     (iVar1 = unaff_EBX[1], unaff_EBX[1] = iVar1 + -1, iVar1 + -1 == 0)) {

    (**(code **)*unaff_EBX)(1);

  }

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

     (iVar1 = piStack_c[1], piStack_c[1] = iVar1 + -1, iVar1 + -1 == 0)) {

    (**(code **)*piStack_c)(1);

  }

  return unaff_ESI >> 0x18;

}





// --- FUN_00460d80 at 0x00460D80 (size: 207) ---


uint __thiscall FUN_00460d80(int *param_1,undefined4 param_2)



{

  int iVar1;

  char cVar2;

  undefined4 *unaff_EBX;

  uint unaff_ESI;

  undefined4 *unaff_retaddr;

  int *piStack_c;

  undefined4 local_8;

  undefined4 local_4;

  

  piStack_c = (int *)(uint)(uint3)piStack_c;

  local_8 = 0;

  local_4 = 0;

  cVar2 = (**(code **)(*param_1 + 0xd0))(param_2,&local_8);

  if (cVar2 == '\0') {

    cVar2 = FUN_0042a2d0(param_2);

    if (((cVar2 == '\0') || (piStack_c == (int *)0x0)) ||

       (cVar2 = (**(code **)(*piStack_c + 0xb0))(unaff_retaddr), cVar2 == '\0')) {

      *unaff_retaddr = DAT_0083e1c8;

    }

  }

  else if ((piStack_c != (int *)0x0) &&

          (cVar2 = (**(code **)(*piStack_c + 0xb0))(unaff_retaddr), cVar2 != '\0')) {

    unaff_ESI = 0x1000000;

  }

  if ((unaff_EBX != (undefined4 *)0x0) &&

     (iVar1 = unaff_EBX[1], unaff_EBX[1] = iVar1 + -1, iVar1 + -1 == 0)) {

    (**(code **)*unaff_EBX)(1);

  }

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

     (iVar1 = piStack_c[1], piStack_c[1] = iVar1 + -1, iVar1 + -1 == 0)) {

    (**(code **)*piStack_c)(1);

  }

  return unaff_ESI >> 0x18;

}





// --- FUN_00460e50 at 0x00460E50 (size: 404) ---


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



int __thiscall FUN_00460e50(int *param_1,double param_2)



{

  int iVar1;

  int iVar2;

  char cVar3;

  undefined4 *local_a0;

  int *local_9c;

  int local_98;

  undefined4 local_94;

  undefined1 local_90 [144];

  

  iVar2 = DAT_0083e03c;

  if (DAT_0083e03c != 0) {

    FUN_0042dc80();

    cVar3 = FUN_0042ce00(1);

    if (cVar3 == '\0') {

      local_a0 = (undefined4 *)0x0;

      local_9c = (int *)0x0;

      cVar3 = (**(code **)(*param_1 + 0xd0))(0x49,&local_a0);

      if ((cVar3 != '\0') && (local_9c != (int *)0x0)) {

        (**(code **)(*local_9c + 0xc0))(local_90);

      }

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

        iVar1 = local_a0[1];

        local_a0[1] = iVar1 + -1;

        if (iVar1 + -1 == 0) {

          (**(code **)*local_a0)(1);

        }

        local_a0 = (undefined4 *)0x0;

      }

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

         (iVar1 = local_9c[1], local_9c[1] = iVar1 + -1, iVar1 + -1 == 0)) {

        (**(code **)*local_9c)(1);

      }

    }

    else {

      FUN_0042de30(param_1 + 0x12d);

    }

    cVar3 = FUN_0042ce00(1);

    if (cVar3 != '\0') {

      cVar3 = FUN_00460990(0x47,&local_94);

      if (cVar3 != '\0') {

        local_98 = DAT_0083e1c8;

        FUN_00460d80(0x48,&local_98);

        if (local_98 != DAT_0083e1c8) {

LAB_00460f89:

          FUN_0045df70(local_90,param_1,local_94,local_98,0);

          iVar2 = *(int *)(iVar2 + 0x2f8);

          if ((iVar2 != 0) && (param_2 != _DAT_00795610)) {

            FUN_004593e0((float)param_2);

          }

          FUN_0042e590();

          return iVar2;

        }

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

          local_98 = *(int *)(param_1[0x8e] + 0x28);

        }

        if (local_98 != DAT_0083e1c8) goto LAB_00460f89;

      }

    }

    FUN_0042e590();

  }

  return 0;

}





// --- FUN_00460ff0 at 0x00460FF0 (size: 193) ---


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



{

  undefined4 uVar1;

  int iVar2;

  undefined4 local_28;

  int local_24;

  undefined4 local_20;

  int local_1c;

  undefined4 local_18;

  int local_14;

  int local_10;

  int local_c;

  int local_8;

  undefined4 local_4;

  

  FUN_006a0ea0(param_2,param_3,param_4);

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

  iVar2 = FUN_0069fe30();

  local_c = FUN_0069fe00();

  local_c = param_2 - local_c;

  local_1c = param_4;

  local_20 = 0x1c;

  local_18 = 0;

  local_4 = 0;

  local_14 = param_2;

  local_10 = param_3;

  local_28 = uVar1;

  local_24 = param_1;

  local_8 = param_3 - iVar2;

  if (DAT_0083e03c != 0) {

    FUN_0045ac50(&local_28);

  }

  if ((((*(uint *)(param_1 + 0x554) >> 7 & 1) != 0) && (param_4 == 8)) &&

     (local_20 = 0x27, DAT_0083e03c != 0)) {

    FUN_0045ac50(&local_28);

  }

  return;

}





// --- FUN_00461210 at 0x00461210 (size: 1100) ---


void __thiscall FUN_00461210(int *param_1,int param_2,int param_3)



{

  char cVar1;

  char cVar2;

  char cVar3;

  char cVar4;

  int iVar5;

  int iVar6;

  int iVar7;

  int iVar8;

  char local_1d;

  int iStack_1c;

  int local_18;

  int local_14;

  int iStack_10;

  int iStack_c;

  int local_8;

  int iStack_4;

  

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

    return;

  }

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

    local_1d = '\0';

  }

  else {

    local_1d = (**(code **)(*DAT_00837ff4 + 0x58))();

  }

  iVar6 = param_1[0x121];

  local_8 = param_2 - param_1[0x125];

  local_14 = param_3 - param_1[0x126];

  iVar8 = param_1[0x122];

  iStack_1c = param_1[0x124] + iVar6;

  iVar7 = param_1[0x123] + iVar8;

  cVar1 = FUN_00460b30(0x3f,&local_18);

  cVar2 = FUN_00460b30(0x3d,&iStack_4);

  cVar3 = FUN_00460b30(0x3e,&iStack_10);

  cVar4 = FUN_00460b30(0x3c,&iStack_c);

  switch(param_1[0x120]) {

  case 1:

    iVar8 = iVar8 + local_14;

    iVar6 = iVar6 + local_8;

    if ((cVar1 != '\0') && (iStack_1c - iVar6 < local_18)) {

      iVar6 = iStack_1c - local_18;

    }

    if ((cVar2 != '\0') && (iStack_4 < iStack_1c - iVar6)) {

      iVar6 = iStack_1c - iStack_4;

    }

    if ((cVar3 != '\0') && (iVar7 - iVar8 < iStack_10)) {

      iVar8 = iVar7 - iStack_10;

    }

    goto LAB_00461435;

  case 2:

    iVar8 = iVar8 + local_14;

    if ((cVar3 != '\0') && (iVar7 - iVar8 < iStack_10)) {

      iVar8 = iVar7 - iStack_10;

    }

LAB_00461435:

    if ((cVar4 != '\0') && (iStack_c < iVar7 - iVar8)) {

      iVar8 = iVar7 - iStack_c;

    }

    break;

  case 3:

    iStack_1c = iStack_1c + local_8;

    iVar8 = iVar8 + local_14;

    if ((cVar1 != '\0') && (iStack_1c - iVar6 < local_18)) {

      iStack_1c = local_18 + iVar6;

    }

    if ((cVar2 != '\0') && (iStack_4 < iStack_1c - iVar6)) {

      iStack_1c = iStack_4 + iVar6;

    }

    if ((cVar3 != '\0') && (iVar7 - iVar8 < iStack_10)) {

      iVar8 = iVar7 - iStack_10;

    }

    if ((cVar4 != '\0') && (iStack_c < iVar7 - iVar8)) {

      iVar8 = iVar7 - iStack_c;

    }

    break;

  case 4:

    iStack_1c = iStack_1c + local_8;

    if ((cVar1 != '\0') && (iStack_1c - iVar6 < local_18)) {

      iStack_1c = local_18 + iVar6;

    }

    if ((cVar2 != '\0') && (iStack_4 < iStack_1c - iVar6)) {

      iStack_1c = iStack_4 + iVar6;

    }

    break;

  case 5:

    iStack_1c = iStack_1c + local_8;

    iVar7 = iVar8 + local_14 + param_1[0x123];

    if ((cVar1 != '\0') && (iStack_1c - iVar6 < local_18)) {

      iStack_1c = local_18 + iVar6;

    }

    if ((cVar2 != '\0') && (iStack_4 < iStack_1c - iVar6)) {

      iStack_1c = iStack_4 + iVar6;

    }

    goto LAB_0046151c;

  case 6:

    iVar7 = iVar8 + local_14 + param_1[0x123];

LAB_0046151c:

    if ((cVar3 != '\0') && (iVar7 - iVar8 < iStack_10)) {

      iVar7 = iStack_10 + iVar8;

    }

LAB_00461535:

    if ((cVar4 != '\0') && (iStack_c < iVar7 - iVar8)) {

      iVar7 = iStack_c + iVar8;

    }

    break;

  case 7:

    iVar7 = iVar8 + local_14 + param_1[0x123];

    iVar6 = iVar6 + local_8;

    if ((cVar1 != '\0') && (iStack_1c - iVar6 < local_18)) {

      iVar6 = iStack_1c - local_18;

    }

    if ((cVar2 != '\0') && (iStack_4 < iStack_1c - iVar6)) {

      iVar6 = iStack_1c - iStack_4;

    }

    if ((cVar3 != '\0') && (iVar7 - iVar8 < iStack_10)) {

      iVar7 = iStack_10 + iVar8;

    }

    goto LAB_00461535;

  case 8:

    iVar6 = iVar6 + local_8;

    if ((cVar1 != '\0') && (iStack_1c - iVar6 < local_18)) {

      iVar6 = iStack_1c - local_18;

    }

    if ((cVar2 != '\0') && (iStack_4 < iStack_1c - iVar6)) {

      iVar6 = iStack_1c - iStack_4;

    }

  }

  if (local_1d != '\0') {

    if (iVar6 % 10 != 0) {

      iVar6 = iVar6 - iVar6 % 10;

    }

    if (iVar8 % 10 != 0) {

      iVar8 = iVar8 - iVar8 % 10;

    }

    if (iStack_1c % 10 != 0) {

      iStack_1c = iStack_1c - iStack_1c % 10;

    }

    if (iVar7 % 10 != 0) {

      iVar7 = iVar7 - iVar7 % 10;

    }

  }

  if (iVar6 < 0) {

    iVar6 = 0;

  }

  if (iVar8 < 0) {

    iVar8 = 0;

  }

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

  iVar5 = FUN_0069fe60();

  if (iVar5 < iStack_1c) {

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

    iStack_1c = FUN_0069fe60();

  }

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

  iVar5 = FUN_0069fe70();

  if (iVar5 < iVar7) {

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

    iVar7 = FUN_0069fe70();

  }

  (**(code **)(*param_1 + 0x30))(iStack_1c - iVar6,iVar7 - iVar8);

  (**(code **)(*param_1 + 0x2c))(iVar6,iVar8);

  return;

}





// --- FUN_004616b0 at 0x004616B0 (size: 45) ---


void __thiscall FUN_004616b0(int param_1,byte param_2)



{

  *(uint *)(param_1 + 0xa4) =

       *(uint *)(param_1 + 0xa4) ^ (*(uint *)(param_1 + 0xa4) ^ (uint)param_2) & 1;

  FUN_00460410(0x1b,(uint)param_2,0);

  return;

}





// --- FUN_00461860 at 0x00461860 (size: 19) ---


undefined4 FUN_00461860(undefined4 param_1)



{

  FUN_00460410(0x15,param_1,0);

  return 1;

}





// --- FUN_004618a0 at 0x004618A0 (size: 123) ---


void __thiscall FUN_004618a0(int *param_1,undefined4 param_2)



{

  char cVar1;

  

  cVar1 = FUN_0042d540(param_2);

  if (cVar1 == '\0') {

    FUN_0042de30(param_2);

    if (DAT_0083e03c != 0) {

      if ((*(int **)(DAT_0083e03c + 0x2f4) == param_1) && (*(int *)(DAT_0083e03c + 0x2f8) != 0)) {

        FUN_0045c440();

      }

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

        cVar1 = (**(code **)(*param_1 + 0x124))();

        if (cVar1 == '\0') {

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

          return;

        }

      }

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

    }

  }

  return;

}





// --- FUN_00461ba0 at 0x00461BA0 (size: 263) ---


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



{

  int *piVar1;

  undefined4 *puVar2;

  int iVar3;

  undefined4 uVar4;

  undefined4 uVar5;

  

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

  if (param_2 != piVar1) {

    param_1[0x155] = param_1[0x155] & 0xfffeffff;

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

      piVar1[0xf] = 0;

      FUN_00448f20(param_1[0x2c]);

      puVar2 = (undefined4 *)param_1[0x2c];

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

        piVar1 = puVar2 + 1;

        *piVar1 = *piVar1 + -1;

        if (*piVar1 == 0) {

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

        }

        param_1[0x2c] = 0;

      }

    }

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

      uVar4 = FUN_0069fe60();

      uVar5 = FUN_0069fe70();

      iVar3 = *param_2;

      uVar4 = FUN_0069fe30(uVar4,uVar5);

      uVar4 = FUN_0069fe00(uVar4);

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

      *(byte *)(param_2 + 2) = (byte)((uint)param_1[0x29] >> 1) & 1;

      if (param_2[3] != 0) {

        FUN_00448be0();

      }

      param_2[4] = param_1[0x25];

      iVar3 = DAT_008379b4;

      param_2[6] = DAT_008379b0;

      param_2[7] = iVar3;

      FUN_00449320(param_2);

      param_1[0x155] = param_1[0x155] | 0x10000;

      param_1[0x2c] = (int)param_2;

      param_2[0xf] = (int)param_1;

      (**(code **)(*param_1 + 0x24))(param_1[0x156]);

      FUN_006a0430();

    }

  }

  return 1;

}





// --- FUN_00461cb0 at 0x00461CB0 (size: 167) ---


void __thiscall FUN_00461cb0(int *param_1,uint param_2)



{

  char cVar1;

  int *local_4;

  

  param_1[0x155] = param_1[0x155] ^ ((param_2 & 0xff) << 0xe ^ param_1[0x155]) & 0x4000;

  local_4 = param_1;

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

    cVar1 = FUN_00460990(0xcd,&local_4);

    if (cVar1 != '\0') {

      param_1[0x155] =

           param_1[0x155] ^ ((uint)(local_4 != (int *)0x0) << 0xe ^ param_1[0x155]) & 0x4000;

    }

  }

  param_2 = 0;

  if ((((uint)param_1[0x29] >> 1 & 1) != 0) && (((uint)param_1[0x155] >> 0xe & 1) != 0)) {

    (**(code **)(*param_1 + 0x11c))(&param_2);

  }

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

  return;

}





// --- FUN_00461d60 at 0x00461D60 (size: 200) ---


undefined4 __fastcall FUN_00461d60(int *param_1)



{

  uint uVar1;

  char cVar2;

  int *piVar3;

  undefined4 uVar4;

  int iVar5;

  

  uVar1 = param_1[0x155];

  cVar2 = FUN_004603a0();

  if (cVar2 != '\0') {

    if (((uint)param_1[0x155] >> 0x15 & 1) != 0) {

      param_1[0x155] = param_1[0x155] | 0x100000;

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

      if (DAT_0083e03c != 0) {

        FUN_0045c540(param_1,1);

        FUN_0045c4a0(param_1);

        iVar5 = (**(code **)(*param_1 + 0xa0))();

        if (iVar5 != 0) {

          piVar3 = (int *)(**(code **)(*param_1 + 0xa0))();

          (**(code **)(*piVar3 + 0x48))(param_1);

        }

        if ((~(byte)(uVar1 >> 0x14) & 1) != 0) {

          FUN_00460410(0x29,0,0);

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

            FUN_0045b970(param_1[0x69]);

          }

        }

        return 1;

      }

      return 0;

    }

    piVar3 = (int *)FUN_0045fb30();

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

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

                    /* WARNING: Treating indirect jump as call */

      uVar4 = (**(code **)(*piVar3 + 0xfc))();

      return uVar4;

    }

  }

  return 0;

}





// --- FUN_00461e30 at 0x00461E30 (size: 142) ---


undefined4 __fastcall FUN_00461e30(int *param_1)



{

  uint uVar1;

  int *piVar2;

  undefined4 uVar3;

  

  uVar1 = param_1[0x155];

  if ((uVar1 >> 0x15 & 1) != 0) {

    param_1[0x155] = uVar1 & 0xffefffff;

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

    if (DAT_0083e03c != 0) {

      FUN_0045c540(param_1,0);

      if ((uVar1 >> 0x14 & 1) != 0) {

        FUN_00460410(0x2a,0,0);

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

          FUN_0045b970(0);

        }

      }

      return 1;

    }

    return 0;

  }

  piVar2 = (int *)FUN_0045fb30();

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

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

                    /* WARNING: Treating indirect jump as call */

    uVar3 = (**(code **)(*piVar2 + 0x100))();

    return uVar3;

  }

  return 0;

}





// --- FUN_00461ec0 at 0x00461EC0 (size: 66) ---


undefined4 __fastcall FUN_00461ec0(int param_1)



{

  int iVar1;

  

  iVar1 = FUN_0045fb30();

  if (iVar1 != 0) {

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

    *(uint *)(param_1 + 0x554) = *(uint *)(param_1 + 0x554) & 0xffbfffff;

    if ((DAT_0083e03c != 0) && (*(int *)(DAT_0083e03c + 0x328) == param_1)) {

      FUN_0045b970(0);

    }

  }

  return 1;

}





// --- FUN_00461fb0 at 0x00461FB0 (size: 138) ---


void __fastcall FUN_00461fb0(int *param_1)



{

  uint uVar1;

  char cVar2;

  int iVar3;

  undefined4 unaff_ESI;

  undefined4 *unaff_retaddr;

  

  uVar1 = param_1[0x155];

  while ((uVar1 >> 0xe & 1) == 0) {

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

      return;

    }

    param_1 = (int *)(**(code **)(*param_1 + 0xa0))();

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

      return;

    }

    uVar1 = param_1[0x155];

  }

  iVar3 = (**(code **)(*param_1 + 0x94))(0x10);

  if (iVar3 != 0) {

    *unaff_retaddr = 3;

    return;

  }

  cVar2 = FUN_00460990(0xcd,&stack0xfffffff8);

  if (cVar2 == '\0') {

    *unaff_retaddr = 3;

    return;

  }

  *unaff_retaddr = unaff_ESI;

  return;

}





// --- FUN_00462040 at 0x00462040 (size: 128) ---


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



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



{

  int iVar1;

  int local_4;

  

  local_4 = 3;

  FUN_00461fb0(&local_4);

  if ((local_4 != 2) && (local_4 != 3)) {

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

    if (iVar1 != 0) {

LAB_00462081:

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

      param_2[1] = *(undefined4 *)(iVar1 + 0x34);

      param_2[2] = *(undefined4 *)(iVar1 + 0x38);

      return param_2;

    }

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

      iVar1 = FUN_004592b0();

      if (iVar1 != 0) goto LAB_00462081;

    }

  }

  *param_2 = _DAT_008199c4;

  param_2[1] = DAT_008199c8;

  param_2[2] = DAT_008199cc;

  return param_2;

}





// --- FUN_004620c0 at 0x004620C0 (size: 344) ---


undefined1 __fastcall FUN_004620c0(int param_1)



{

  float fVar1;

  char cVar2;

  int iVar3;

  int iVar4;

  undefined1 uVar5;

  float local_2c;

  float local_28;

  int local_24;

  int local_20;

  float local_1c;

  float local_18;

  int local_14;

  int local_10;

  undefined4 local_c;

  undefined4 local_8;

  undefined4 local_4;

  

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

  uVar5 = 0;

  if (iVar3 == 0) {

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

      return 0;

    }

    iVar3 = FUN_004592b0();

  }

  if (iVar3 != 0) {

    local_28 = 4.2039e-45;

    FUN_00461fb0(&local_28);

    if ((local_28 == 2.8026e-45) || (local_28 == 4.2039e-45)) {

      return 0;

    }

    local_c = *(undefined4 *)(iVar3 + 0x30);

    local_8 = *(undefined4 *)(iVar3 + 0x34);

    local_4 = *(undefined4 *)(iVar3 + 0x38);

    local_1c = 0.0;

    local_18 = 0.0;

    local_14 = 0;

    local_10 = 0;

    FUN_00460110(&local_1c,&local_20);

    local_24 = (local_14 - (int)local_1c) + 1;

    if (local_24 == 0) {

      local_2c = 0.0;

    }

    else {

      iVar4 = FUN_0069fe60();

      local_2c = (float)iVar4 / (float)local_24;

    }

    local_20 = (local_10 - (int)local_18) + 1;

    fVar1 = DAT_00796344;

    if (local_20 != 0) {

      local_24 = FUN_0069fe70();

      fVar1 = (float)local_24 / (float)local_20;

    }

    local_28 = fVar1;

    local_1c = local_2c;

    local_14 = 0x3f800000;

    local_18 = local_28;

    cVar2 = FUN_0045fad0(&local_1c);

    if (cVar2 != '\0') {

      *(float *)(iVar3 + 0x30) = local_2c;

      *(float *)(iVar3 + 0x34) = local_28;

      *(undefined4 *)(iVar3 + 0x38) = 0x3f800000;

      uVar5 = 1;

    }

  }

  return uVar5;

}





// --- FUN_00462270 at 0x00462270 (size: 221) ---


undefined4 __thiscall FUN_00462270(int param_1,char param_2)



{

  uint uVar1;

  int iVar2;

  int iVar3;

  int iVar4;

  int iVar5;

  undefined1 local_c [12];

  

  uVar1 = *(uint *)(param_1 + 0x554) >> 0xe;

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

    FUN_00462040(local_c);

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

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

    iVar5 = (*(int *)(param_1 + 0x564) - iVar2) + 1;

    iVar4 = (*(int *)(param_1 + 0x568) - iVar3) + 1;

    if (param_2 == '\0') {

      FUN_0069fe60();

      iVar5 = FUN_005df4c4();

      FUN_0069fe70();

      iVar4 = FUN_005df4c4();

    }

    else {

      iVar2 = FUN_005df4c4();

      iVar3 = FUN_005df4c4();

    }

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

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

    *(int *)(param_1 + 0x564) = iVar2 + -1 + iVar5;

    uVar1 = *(int *)(param_1 + 0x560) + -1 + iVar4;

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

  }

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

}





// --- FUN_00462350 at 0x00462350 (size: 64) ---


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



{

  *param_1 = &PTR_FUN_0079cf54;

  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_00462390 at 0x00462390 (size: 144) ---


void __thiscall FUN_00462390(int *param_1,undefined4 param_2)



{

  uint uVar1;

  int iVar2;

  char cVar3;

  char cVar4;

  byte bVar5;

  

  iVar2 = DAT_0083e03c;

  cVar3 = FUN_004603a0();

  uVar1 = param_1[0x29];

  FUN_006a0d50(param_2);

  cVar4 = FUN_004603a0();

  bVar5 = (byte)((uint)param_1[0x29] >> 1) & 1;

  if (bVar5 != ((byte)(uVar1 >> 1) & 1)) {

    FUN_00460410(0x18,bVar5,0);

  }

  if (cVar3 != cVar4) {

    if ((((uint)param_1[0x155] >> 6 & 1) != 0) && (iVar2 != 0)) {

      FUN_0045b4c0(7,0);

    }

    (**(code **)(*param_1 + 0xf8))(cVar4);

  }

  return;

}





// --- FUN_00462420 at 0x00462420 (size: 361) ---


void __thiscall FUN_00462420(int *param_1,int param_2)



{

  int iVar1;

  int iVar2;

  uint uVar3;

  

  iVar2 = param_2;

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

    switch(*(undefined4 *)(param_2 + 8)) {

    case 0x29:

      if ((param_1[0x100] == 0) || (param_1[0x100] == 1)) {

        (**(code **)(*param_1 + 0x9c))(5);

        (**(code **)(*param_1 + 0x128))(iVar2,0);

        return;

      }

      break;

    case 0x2a:

      if (param_1[0x100] == 5) {

        (**(code **)(*param_1 + 0x9c))(1);

        (**(code **)(*param_1 + 0x128))(iVar2,0);

        return;

      }

      break;

    case 0x2f:

      iVar1 = param_1[0x100];

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

        if (((iVar1 == 0) || (iVar1 == 1)) || (iVar1 == 5)) {

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

          (**(code **)(*param_1 + 0x128))(iVar2,0);

          return;

        }

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

      }

      if (iVar1 == 4) {

        (**(code **)(*param_1 + 0x9c))(((uint)param_1[0x155] >> 0x14 & 1) << 2 | 1);

        (**(code **)(*param_1 + 0x128))(iVar2,0);

        return;

      }

      break;

    case 0x31:

      param_2 = 0;

      FUN_00460990(0x58,&param_2);

      if (param_2 == 1) {

        uVar3 = CONCAT31((uint3)((uint)param_1[0x29] >> 9),~(byte)((uint)param_1[0x29] >> 1)) &

                0xffffff01;

      }

      else {

        if (param_2 == 2) {

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

          (**(code **)(*param_1 + 0x128))(iVar2,0);

          return;

        }

        if (param_2 != 3) break;

        uVar3 = 0;

      }

      (**(code **)(*param_1 + 0x18))(uVar3);

    }

  }

  (**(code **)(*param_1 + 0x128))(iVar2,0);

  return;

}





// --- FUN_004625b0 at 0x004625B0 (size: 65) ---


bool __thiscall FUN_004625b0(int *param_1,undefined4 param_2)



{

  char cVar1;

  

  FUN_00425ba0();

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

    return false;

  }

  cVar1 = FUN_00427240(8,param_2);

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

  return cVar1 != '\0';

}





// --- FUN_004626c0 at 0x004626C0 (size: 86) ---


void __fastcall FUN_004626c0(int *param_1)



{

  char cVar1;

  undefined1 uVar2;

  undefined1 local_90 [144];

  

  FUN_0042dc80();

  FUN_004618a0(local_90);

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

    cVar1 = (**(code **)(*param_1 + 0x124))();

    if (cVar1 == '\0') {

      uVar2 = 0;

      goto LAB_004626ff;

    }

  }

  uVar2 = 1;

LAB_004626ff:

  *(undefined1 *)((int)param_1 + 0x545) = uVar2;

  FUN_0042e590();

  return;

}





// --- FUN_00462720 at 0x00462720 (size: 952) ---


undefined4 __fastcall FUN_00462720(int *param_1)



{

  int iVar1;

  int iVar2;

  int iVar3;

  int *piVar4;

  int iVar5;

  int iStack_50;

  int iStack_4c;

  int iStack_48;

  undefined1 local_44 [4];

  int local_40;

  int local_3c;

  int local_38;

  int local_34;

  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;

  

  iVar5 = 0;

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

    return 0;

  }

  local_30 = 0;

  local_2c = 0;

  local_28 = 0;

  local_24 = 0;

  FUN_00460110(&local_30,local_44);

  local_40 = local_30;

  local_38 = local_28;

  local_3c = local_2c;

  local_34 = local_24;

  local_10 = 0;

  local_c = 0;

  local_8 = 0;

  local_4 = 0;

  local_20 = 0;

  local_1c = 0;

  local_18 = 0;

  local_14 = 0;

  iVar1 = (**(code **)(*param_1 + 0xa0))();

  if ((iVar1 == 0) || (((uint)param_1[0x155] >> 0x15 & 1) != 0)) {

    iVar3 = *(int *)(param_1[0x8e] + 0x30) + -1;

    local_4 = *(int *)(param_1[0x8e] + 0x34) + -1;

    local_c = 0;

    iVar1 = FUN_0054fd30();

    local_18 = FUN_0054fd20();

    local_18 = local_18 + -1;

    iStack_50 = iVar1 + -1;

    iVar1 = 0;

    local_20 = 0;

  }

  else {

    FUN_00460110(&local_10,&iStack_50);

    FUN_00460180(&local_20,&iStack_50);

    iStack_50 = local_14;

    iVar1 = local_1c;

    iVar5 = local_10;

    iVar3 = local_8;

  }

  iStack_50 = iStack_50 - iVar1;

  iVar1 = (iStack_50 - local_4) + local_c;

  iStack_4c = iVar3 - iVar5;

  iVar5 = ((local_18 - iVar3) - local_20) + iVar5;

  iStack_48 = (local_4 - local_c) + 1;

  if (iStack_48 != 0) {

    iStack_4c = iStack_50;

  }

  iStack_4c = iStack_4c + 1;

  iVar3 = param_1[0xbf];

  if (iVar3 == 2) {

    local_40 = iVar5 + local_30;

  }

  else if (iVar3 == 3) {

    local_40 = ((local_18 - local_20) + 1) / 2 - ((local_28 - local_30) + 1) / 2;

  }

  else if (iVar3 == 4) {

    local_40 = FUN_005df4c4();

  }

  iVar3 = param_1[0xc1];

  if (iVar3 == 1) {

    iVar5 = local_28 + iVar5;

    local_38 = iVar5;

  }

  else if (iVar3 == 3) {

    iVar5 = ((local_18 - local_20) + 1) / 2 + -1 + ((local_28 - local_30) + 1) / 2;

    local_38 = iVar5;

  }

  else {

    iVar5 = local_38;

    if (iVar3 == 4) {

      iVar5 = FUN_005df4c4();

    }

  }

  iVar3 = param_1[0xc0];

  if (iVar3 == 2) {

    local_3c = local_2c + iVar1;

  }

  else if (iVar3 == 3) {

    local_3c = (iStack_50 + 1) / 2 - ((local_24 - local_2c) + 1) / 2;

  }

  else if (iVar3 == 4) {

    local_3c = FUN_005df4c4();

  }

  iVar3 = param_1[0xc2];

  if (iVar3 == 1) {

    iVar2 = local_24 + iVar1;

    local_34 = iVar2;

  }

  else if (iVar3 == 3) {

    iVar2 = ((local_24 - local_2c) + 1) / 2 + -1 + (iStack_50 + 1) / 2;

    local_34 = iVar2;

  }

  else {

    iVar2 = local_34;

    if (iVar3 == 4) {

      iVar2 = FUN_005df4c4();

    }

  }

  iVar3 = FUN_0069fe60();

  if (((iVar3 != 0) || (iVar3 = FUN_0069fe70(), iVar3 != 0)) ||

     (((uint)param_1[0x155] >> 0x11 & 1) != 0)) {

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

      local_40 = param_1[0x1f];

    }

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

      local_3c = param_1[0x20];

    }

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

      iVar5 = param_1[0x21];

      local_38 = param_1[0x21];

    }

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

      iVar2 = param_1[0x22];

      local_34 = param_1[0x22];

    }

  }

  iVar3 = local_3c;

  (**(code **)(*param_1 + 0x2c))(local_40,local_3c);

  (**(code **)(*param_1 + 0x30))((iVar5 - iStack_48) + 1,(iVar2 - iVar3) + 1);

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

    piVar4 = (int *)(**(code **)(*param_1 + 0xa0))();

    param_1[0x25] = iVar1;

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

      (**(code **)(*piVar4 + 0x70))(param_1);

      (**(code **)(*piVar4 + 0x6c))(param_1);

    }

  }

  return 1;

}





// --- FUN_00462ae0 at 0x00462AE0 (size: 67) ---


bool __thiscall FUN_00462ae0(uint *param_1,uint *param_2)



{

  uint uVar1;

  uint uVar2;

  uint uVar3;

  int iVar4;

  

  uVar1 = *param_2;

  uVar2 = *param_1;

  if (uVar2 == uVar1) {

    return false;

  }

  uVar3 = uVar2 - uVar1;

  iVar4 = 1;

  if (uVar2 < uVar1) {

    uVar3 = uVar1 - uVar2;

    iVar4 = -1;

  }

  if (0x7fffffff < uVar3) {

    iVar4 = -iVar4;

  }

  return iVar4 < 0;

}





// --- FUN_00462b30 at 0x00462B30 (size: 202) ---


void __thiscall FUN_00462b30(int *param_1,int param_2)



{

  int *piVar1;

  char cVar2;

  int iVar3;

  int iVar4;

  int iVar5;

  undefined4 uVar6;

  undefined4 uVar7;

  

  iVar3 = (**(code **)(*param_1 + 0xa0))();

  iVar4 = FUN_0069fe00();

  iVar5 = FUN_0069fe30();

  if (iVar3 != param_2) {

    iVar3 = FUN_0045fb30();

    if (((iVar3 != 0) && (piVar1 = *(int **)(iVar3 + 0x1a4), piVar1 != (int *)0x0)) &&

       ((piVar1 == param_1 || (cVar2 = FUN_0045fbb0(param_1), cVar2 != '\0')))) {

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

    }

    FUN_006a04e0(param_2);

    if (((uint)param_1[0x155] >> 0xb & 1) != 0) {

      uVar7 = 0;

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

      FUN_00460410(0x26,uVar6,uVar7);

    }

    FUN_00462720();

    iVar3 = FUN_0069fe00();

    if ((iVar4 != iVar3) || (iVar3 = FUN_0069fe30(), iVar5 != iVar3)) {

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

    }

    (**(code **)(*param_1 + 0x24))(param_1[0x156]);

    return;

  }

  return;

}





// --- FUN_00462d70 at 0x00462D70 (size: 226) ---


void __fastcall FUN_00462d70(int *param_1)



{

  int iVar1;

  char cVar2;

  undefined1 uVar3;

  int *piVar4;

  int iVar5;

  

  FUN_00465ec0(param_1 + 0xb6);

  param_1[0x155] = param_1[0x155] | 0x20000;

  (**(code **)(*param_1 + 0x9c))(param_1[0xbe]);

  piVar4 = (int *)FUN_0052dcf0(&stack0xfffffff0);

  iVar5 = piVar4[2];

  iVar1 = *piVar4;

  piVar4 = (int *)piVar4[1];

  while (iVar5 != 0) {

    do {

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

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

    } while (iVar5 != 0);

    do {

      piVar4 = piVar4 + 1;

      if (piVar4 == (int *)(*(int *)(iVar1 + 0x60) + *(int *)(iVar1 + 0x68) * 4)) goto LAB_00462e03;

      iVar5 = *piVar4;

    } while (iVar5 == 0);

  }

LAB_00462e03:

  if (((char)param_1[0x151] == '\0') && (cVar2 = (**(code **)(*param_1 + 0x124))(), cVar2 == '\0'))

  {

    uVar3 = 0;

  }

  else {

    uVar3 = 1;

  }

  *(undefined1 *)((int)param_1 + 0x545) = uVar3;

  if ((((uint)param_1[0x155] >> 0xc & 1) != 0) && (DAT_0083e03c != 0)) {

    FUN_0045b4c0(6,param_1);

  }

  return;

}





// --- FUN_00462e60 at 0x00462E60 (size: 1160) ---


void __thiscall FUN_00462e60(int *param_1,uint param_2)



{

  uint uVar1;

  char cVar2;

  undefined4 uVar3;

  undefined4 unaff_retaddr;

  undefined4 local_10;

  int local_c;

  int local_8 [2];

  

  uVar1 = param_2;

  uVar3 = FUN_00429a00();

  switch(uVar3) {

  case 0x33:

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

      (**(code **)(**(int **)(uVar1 + 4) + 0x70))(&param_2);

    }

    FUN_004592d0(param_2);

    return;

  case 0x34:

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

      (**(code **)(**(int **)(uVar1 + 4) + 0x70))(&param_2);

    }

    FUN_0045f9f0(param_2);

    return;

  case 0x37:

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

      (**(code **)(**(int **)(uVar1 + 4) + 0x70))(&param_2);

    }

    FUN_0045fa90(param_2);

    FUN_00460340();

    return;

  case 0x3a:

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

      (**(code **)(**(int **)(uVar1 + 4) + 0x70))(&param_2);

    }

    FUN_0045f9d0(param_2);

    return;

  case 0x3b:

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

      (**(code **)(**(int **)(uVar1 + 4) + 0x70))(&param_2);

    }

    (**(code **)(*param_1 + 0x18))((char)param_2 == '\0');

    return;

  case 0x40:

    param_2 = param_2 & 0xffffff00;

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

      (**(code **)(**(int **)(uVar1 + 4) + 0x70))(&param_2);

    }

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

    return;

  case 0x41:

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

      (**(code **)(**(int **)(uVar1 + 4) + 0x70))(&param_2);

    }

    FUN_0045fa50(param_2);

    return;

  case 0x42:

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

      (**(code **)(**(int **)(uVar1 + 4) + 0x70))(&param_2);

    }

    FUN_0045fa70(param_2);

    return;

  case 0x43:

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

      (**(code **)(**(int **)(uVar1 + 4) + 0x70))(&param_2);

    }

    FUN_0045fab0(param_2);

    return;

  case 0x44:

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

      (**(code **)(**(int **)(uVar1 + 4) + 0x70))(&param_2);

    }

    param_1[0x155] = param_1[0x155] ^ (param_2 & 0xff ^ param_1[0x155]) & 1;

    return;

  case 0x45:

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

      (**(code **)(**(int **)(uVar1 + 4) + 0x70))(&param_2);

    }

    FUN_0045fa10(param_2);

    return;

  case 0x46:

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

      (**(code **)(**(int **)(uVar1 + 4) + 0x70))(&param_2);

    }

    FUN_0045fa30(param_2);

    return;

  case 0x4b:

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

      (**(code **)(**(int **)(uVar1 + 4) + 0x70))(&param_2);

    }

    FUN_0045f9b0(param_2);

    return;

  case 0x4d:

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

      (**(code **)(**(int **)(uVar1 + 4) + 0x88))(&param_2);

    }

    FUN_006a0460(param_2);

    return;

  case 0x4e:

    FUN_00429940(param_1 + 0x17b);

    return;

  case 0x51:

    param_2 = (uint)param_2._1_3_ << 8;

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

      (**(code **)(**(int **)(uVar1 + 4) + 0x70))(&param_2);

    }

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

    return;

  case 0x52:

    param_2 = 0;

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

      (**(code **)(**(int **)(uVar1 + 4) + 0xa8))(&param_2);

    }

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

    return;

  case 0x53:

    param_2 = (uint)param_2._1_3_ << 8;

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

      (**(code **)(**(int **)(uVar1 + 4) + 0x70))(&param_2);

    }

    param_1[0x29] = param_1[0x29] | 0x80;

    FUN_006a0430();

    return;

  case 0x54:

    if ((*(int **)(uVar1 + 4) != (int *)0x0) &&

       (cVar2 = (**(code **)(**(int **)(uVar1 + 4) + 0x78))(&param_2), cVar2 != '\0')) {

      local_8[0] = param_1[0x24];

      FUN_006a05b0(&local_c);

      return;

    }

    break;

  case 0x55:

    if ((*(int **)(uVar1 + 4) != (int *)0x0) &&

       (cVar2 = (**(code **)(**(int **)(uVar1 + 4) + 0x78))(&param_2), cVar2 != '\0')) {

      local_c = param_1[0x23];

      FUN_006a05b0(&local_c);

      return;

    }

    break;

  case 0x56:

    local_8[0] = 0;

    local_8[1] = 0;

    local_10 = 0;

    local_c = 0;

    if ((((*(int **)(uVar1 + 4) != (int *)0x0) &&

         (cVar2 = (**(code **)(**(int **)(uVar1 + 4) + 0x118))(0x54,local_8), cVar2 != '\0')) &&

        (*(int **)(uVar1 + 4) != (int *)0x0)) &&

       (cVar2 = (**(code **)(**(int **)(uVar1 + 4) + 0x118))(0x55,&local_10), cVar2 != '\0')) {

      (**(code **)(*param_1 + 200))(local_8);

      (**(code **)(*param_1 + 200))(&stack0xffffffec);

    }

    FUN_004234d0();

    FUN_004234d0();

    return;

  case 0x57:

    if ((*(int **)(uVar1 + 4) != (int *)0x0) &&

       (cVar2 = (**(code **)(**(int **)(uVar1 + 4) + 0xa8))(&param_2), cVar2 != '\0')) {

      FUN_0045d8e0(unaff_retaddr,param_1);

    }

    break;

  case 0xcd:

    param_2 = 3;

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

      (**(code **)(**(int **)(uVar1 + 4) + 0xa8))(&param_2);

    }

    FUN_00461cb0(param_2 != 0);

    FUN_00462720();

    return;

  }

  return;

}





// --- FUN_004633f0 at 0x004633F0 (size: 197) ---


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



{

  undefined4 uVar1;

  int iVar2;

  undefined4 local_28;

  int local_24;

  undefined4 local_20;

  undefined4 local_1c;

  undefined4 local_18;

  int local_14;

  int local_10;

  int local_c;

  int local_8;

  undefined4 local_4;

  

  if ((*(uint *)(param_1 + 0x554) >> 0x13 & 1) == 0) {

    if ((*(uint *)(param_1 + 0x554) >> 0x12 & 1) != 0) {

      FUN_0045ff10(param_2,param_3);

    }

  }

  else {

    FUN_00461210(param_2,param_3);

  }

  if ((*(int *)(param_1 + 0x19c) != 0) || ((*(uint *)(param_1 + 0x554) >> 0xd & 1) != 0)) {

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

    iVar2 = FUN_0069fe30();

    local_c = FUN_0069fe00();

    local_c = param_2 - local_c;

    local_20 = 0x1e;

    local_1c = 0;

    local_18 = 0;

    local_4 = 0;

    local_14 = param_2;

    local_10 = param_3;

    if (DAT_0083e03c != 0) {

      local_28 = uVar1;

      local_24 = param_1;

      local_8 = param_3 - iVar2;

      FUN_0045ac50(&local_28);

    }

  }

  return;

}





// --- FUN_004634c0 at 0x004634C0 (size: 392) ---


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



{

  int iVar1;

  int iVar2;

  int *piVar3;

  int iVar4;

  int iVar5;

  int iStack_28;

  int *piStack_24;

  undefined4 uStack_20;

  undefined4 uStack_1c;

  undefined4 uStack_18;

  int iStack_14;

  int iStack_10;

  int iStack_c;

  int iStack_8;

  undefined4 uStack_4;

  

  iVar1 = FUN_0069fe00();

  iVar2 = FUN_0069fe30();

  FUN_006a06b0(param_2,param_3);

  if ((*(byte *)((int)param_1 + 0x556) & 1) == 0) {

    FUN_00462270(1);

    FUN_006a0c10(1);

    goto LAB_0046357f;

  }

  piVar3 = (int *)param_1[0x2c];

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

    if (param_1[0x2b] == 0) goto LAB_0046357f;

    piVar3 = (int *)FUN_004592b0();

    if (piVar3 == (int *)0x0) goto LAB_0046357f;

  }

  iVar4 = (**(code **)(*param_1 + 0xa0))();

  if (iVar4 == 0) {

    iVar4 = 0;

    iVar5 = 0;

  }

  else {

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

    iVar4 = FUN_0069fe00();

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

    iVar5 = FUN_0069fe30();

  }

  (**(code **)(*piVar3 + 0xc))(param_1[0x1f] + iVar4,param_1[0x20] + iVar5,piVar3[10],piVar3[0xb]);

LAB_0046357f:

  iVar4 = FUN_0069fe00();

  iVar5 = FUN_0069fe30();

  if ((iVar1 != iVar4) || (iVar2 != iVar5)) {

    if ((((uint)param_1[0x155] >> 4 & 1) != 0) && (DAT_0083e03c != 0)) {

      FUN_0045b4c0(7,0);

    }

    if ((((uint)param_1[0x155] >> 10 & 1) != 0) || (param_1[0x67] != 0)) {

      iStack_28 = param_1[0xb9];

      iStack_c = param_1[0x1f];

      iStack_8 = param_1[0x20];

      uStack_20 = 0x25;

      uStack_1c = 0;

      uStack_18 = 0;

      uStack_4 = 0;

      piStack_24 = param_1;

      iStack_14 = iVar4;

      iStack_10 = iVar5;

      if (DAT_0083e03c != 0) {

        FUN_0045ac50(&iStack_28);

      }

    }

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

  }

  return;

}





// --- FUN_00463650 at 0x00463650 (size: 56) ---


undefined4 __thiscall FUN_00463650(int param_1,uint *param_2)



{

  uint uVar1;

  uint *puVar2;

  bool bVar3;

  

  uVar1 = *param_2;

  puVar2 = *(uint **)(*(int *)(param_1 + 0x60) +

                     ((uVar1 << 0x18 | uVar1 >> 8) % *(uint *)(param_1 + 0x68)) * 4);

  bVar3 = puVar2 == (uint *)0x0;

  if (!bVar3) {

    do {

      if (*puVar2 == uVar1) break;

      puVar2 = (uint *)puVar2[1];

    } while (puVar2 != (uint *)0x0);

    bVar3 = puVar2 == (uint *)0x0;

  }

  return CONCAT31((int3)((uint)puVar2 >> 8),!bVar3);

}





// --- FUN_00463690 at 0x00463690 (size: 40) ---


undefined4 __fastcall FUN_00463690(int param_1)



{

  int iVar1;

  

  iVar1 = 0;

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

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

      iVar1 = 0;

    }

    else {

      iVar1 = *(int *)(param_1 + 0x128) + -8;

    }

  }

  if (iVar1 != 0) {

    return *(undefined4 *)(iVar1 + 0x10);

  }

  return 0;

}





// --- FUN_004636c0 at 0x004636C0 (size: 52) ---


undefined4 __thiscall FUN_004636c0(int param_1,uint *param_2)



{

  uint *puVar1;

  bool bVar2;

  

  puVar1 = *(uint **)(*(int *)(param_1 + 100) + (*param_2 % *(uint *)(param_1 + 0x6c)) * 4);

  bVar2 = puVar1 == (uint *)0x0;

  if (!bVar2) {

    do {

      if (*puVar1 == *param_2) break;

      puVar1 = (uint *)puVar1[1];

    } while (puVar1 != (uint *)0x0);

    bVar2 = puVar1 == (uint *)0x0;

  }

  return CONCAT31((int3)((uint)puVar1 >> 8),!bVar2);

}





// --- FUN_00463700 at 0x00463700 (size: 72) ---


undefined4 __thiscall FUN_00463700(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_00429ab0(puVar1 + 2);

  return 1;

}





// --- FUN_00463750 at 0x00463750 (size: 73) ---


void __fastcall FUN_00463750(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_004641d0(*puVar2);

  return;

}





// --- FUN_004637a0 at 0x004637A0 (size: 66) ---


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



{

  int iVar1;

  undefined4 uVar2;

  

  if ((param_1[1] & 0x7fffffffU) <= (uint)param_1[2]) {

    uVar2 = FUN_00453850((param_1[1] & 0x7fffffffU) + 1);

    uVar2 = FUN_004180a0(uVar2);

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

      return uVar2;

    }

  }

  iVar1 = param_1[2];

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

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

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

}





// --- FUN_00463830 at 0x00463830 (size: 366) ---


void __thiscall FUN_00463830(int *param_1,char param_2)



{

  int iVar1;

  char cVar2;

  int iVar3;

  int iVar4;

  int *piVar5;

  undefined4 unaff_EBX;

  undefined4 local_14;

  int aiStack_10 [4];

  

  iVar1 = DAT_0083e03c;

  if (param_2 == '\0') {

    FUN_00459960(param_1);

    if ((((uint)param_1[0x155] >> 0x14 & 1) != 0) &&

       ((**(code **)(*param_1 + 0x100))(), ((uint)param_1[0x155] >> 0x15 & 1) != 0)) {

      FUN_00459980(0);

    }

    if (((uint)param_1[0x155] >> 0xe & 1) != 0) {

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

    }

  }

  else {

    if (((uint)param_1[0x155] >> 0xe & 1) != 0) {

      local_14 = 0;

      (**(code **)(*param_1 + 0x11c))(&local_14);

      (**(code **)(*param_1 + 0x118))(unaff_EBX);

      cVar2 = FUN_004620c0();

      if (cVar2 != '\0') {

        FUN_0045b150(aiStack_10);

        for (; aiStack_10[0] != 0; aiStack_10[0] = *(int *)(aiStack_10[0] + 8) + -8) {

          if (*(int *)(aiStack_10[0] + 0x10) != 0) {

            FUN_00462720();

          }

          if (*(int *)(aiStack_10[0] + 8) == 0) break;

        }

      }

    }

    if (((uint)param_1[0x155] >> 3 & 1) != 0) {

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

    }

    param_2 = '\0';

    cVar2 = FUN_00460cc0(0x35,&param_2);

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

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

    }

  }

  piVar5 = DAT_00837ff4;

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

    iVar3 = (**(code **)(*DAT_00837ff4 + 0x1c))();

    iVar4 = (**(code **)(*piVar5 + 0x18))();

    piVar5 = (int *)FUN_006a0340(aiStack_10);

    if (((((*piVar5 <= iVar4) && (iVar4 <= piVar5[2])) && (piVar5[1] <= iVar3)) &&

        (iVar3 <= piVar5[3])) || ((*(byte *)(param_1 + 0x29) & 1) != 0)) {

      *(undefined1 *)(iVar1 + 0x240) = 1;

    }

  }

  return;

}





// --- FUN_004639a0 at 0x004639A0 (size: 81) ---


void __fastcall FUN_004639a0(int param_1)



{

  int *piVar1;

  

  piVar1 = (int *)0x0;

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

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

      piVar1 = (int *)0x0;

    }

    else {

      piVar1 = (int *)(*(int *)(param_1 + 0x124) + -8);

    }

  }

  while( true ) {

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

      return;

    }

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

      (**(code **)(*(int *)*piVar1 + 0xc0))();

    }

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

    piVar1 = (int *)(piVar1[2] + -8);

  }

  return;

}





// --- FUN_00463a70 at 0x00463A70 (size: 299) ---


void __thiscall FUN_00463a70(int param_1,int param_2,int param_3,uint param_4)



{

  uint *puVar1;

  undefined4 uVar2;

  int iVar3;

  uint uVar4;

  undefined4 local_28;

  int local_24;

  undefined4 local_20;

  uint local_1c;

  undefined4 local_18;

  int local_14;

  int local_10;

  int local_c;

  int local_8;

  undefined4 local_4;

  

  for (puVar1 = *(uint **)(*(int *)(param_1 + 400) + (param_4 % *(uint *)(param_1 + 0x198)) * 4);

      (puVar1 != (uint *)0x0 && (*puVar1 != param_4)); puVar1 = (uint *)puVar1[1]) {

  }

  FUN_006a0ec0(param_2,param_3,param_4);

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

  iVar3 = FUN_0069fe30();

  local_c = FUN_0069fe00();

  local_c = param_2 - local_c;

  local_10 = param_3;

  local_14 = param_2;

  local_20 = 0x1d;

  local_1c = param_4;

  local_18 = 0;

  local_4 = 0;

  local_28 = uVar2;

  local_24 = param_1;

  local_8 = param_3 - iVar3;

  if (DAT_0083e03c != 0) {

    FUN_0045ac50(&local_28);

  }

  if ((*(byte *)(param_1 + 0xa4) & 1) == 0) {

    return;

  }

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

    return;

  }

  if (local_1c == 10) {

    uVar4 = 7;

LAB_00463b62:

    if ((*(uint *)(param_1 + 0x554) >> 0x17 & 1) != 0) {

      local_20 = 0x1a;

      goto LAB_00463b86;

    }

  }

  else {

    if (local_1c == 0xb) {

      uVar4 = 8;

      goto LAB_00463b62;

    }

    uVar4 = local_1c;

    if (local_1c == 0xc) {

      uVar4 = 9;

      goto LAB_00463b62;

    }

  }

  local_20 = 0x19;

  local_1c = uVar4;

LAB_00463b86:

  if (DAT_0083e03c != 0) {

    FUN_0045ac50(&local_28);

  }

  return;

}





// --- FUN_00463ba0 at 0x00463BA0 (size: 94) ---


int __thiscall FUN_00463ba0(int param_1,int param_2)



{

  int iVar1;

  int iVar2;

  int iVar3;

  

  iVar1 = 0;

  iVar3 = 0;

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

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

      iVar3 = 0;

    }

    else {

      iVar3 = *(int *)(param_1 + 0x124) + -8;

    }

  }

  iVar2 = iVar1;

  if (iVar3 != 0) {

    while (((iVar2 = *(int *)(iVar3 + 0x10), iVar2 == 0 || (*(int *)(iVar2 + 0x2e4) != param_2)) &&

           (iVar2 = iVar1, *(int *)(iVar3 + 8) != 0))) {

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

      if (iVar3 == 0) {

        return iVar1;

      }

    }

  }

  return iVar2;

}





// --- FUN_00463c00 at 0x00463C00 (size: 119) ---


int __thiscall FUN_00463c00(int param_1,undefined4 param_2)



{

  int iVar1;

  int iVar2;

  

  iVar1 = FUN_00463ba0(param_2);

  if (iVar1 != 0) {

    return iVar1;

  }

  iVar1 = 0;

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

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

      iVar1 = 0;

    }

    else {

      iVar1 = *(int *)(param_1 + 0x124) + -8;

    }

  }

  while( true ) {

    if (iVar1 == 0) {

      return 0;

    }

    if ((*(int *)(iVar1 + 0x10) != 0) && (iVar2 = FUN_00463c00(param_2), iVar2 != 0)) break;

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

      return 0;

    }

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

  }

  return iVar2;

}





// --- FUN_00463c80 at 0x00463C80 (size: 143) ---


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



{

  char cVar1;

  int iVar2;

  uint uVar3;

  undefined4 uVar4;

  

  iVar2 = FUN_005df0f5(0x10);

  if (iVar2 == 0) {

    return;

  }

  iVar2 = FUN_0069dc60();

  if (iVar2 == 0) {

    return;

  }

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

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

  FUN_00465c20();

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

  if (uVar3 <= *(uint *)(param_1 + 0x230)) {

    uVar4 = FUN_00453850(uVar3 + 1);

    cVar1 = FUN_004180a0(uVar4);

    if (cVar1 == '\0') goto LAB_00463cf7;

  }

  *(int *)(*(int *)(param_1 + 0x228) + *(int *)(param_1 + 0x230) * 4) = iVar2;

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

LAB_00463cf7:

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

  FUN_00465cd0();

  return;

}





// --- FUN_00463d10 at 0x00463D10 (size: 67) ---


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



{

  int iVar1;

  

  iVar1 = FUN_0069bad0(param_4);

  if ((iVar1 != 0) && (FUN_0069d8e0(param_2,param_3), *(int *)(param_1 + 0x400) == param_4)) {

    FUN_00463c80(param_2,param_3);

  }

  return;

}





// --- FUN_00463d60 at 0x00463D60 (size: 590) ---


void __thiscall FUN_00463d60(int *param_1,int param_2,int param_3)



{

  char cVar1;

  int *piVar2;

  undefined4 uVar3;

  undefined4 uVar4;

  int iVar5;

  int iVar6;

  int local_44;

  int local_40;

  int local_3c;

  int local_38;

  int local_34;

  int local_30;

  int *piStack_2c;

  int iStack_28;

  int *piStack_24;

  undefined4 uStack_20;

  undefined4 uStack_1c;

  undefined4 uStack_18;

  undefined4 uStack_14;

  int iStack_10;

  undefined4 uStack_c;

  undefined4 uStack_8;

  undefined4 uStack_4;

  

  local_34 = FUN_0069fe60();

  local_30 = FUN_0069fe70();

  iVar5 = param_3;

  iVar6 = param_2;

  cVar1 = FUN_00460b30(0x3c,&local_44);

  if ((cVar1 != '\0') && (local_44 < iVar5)) {

    iVar5 = local_44;

  }

  cVar1 = FUN_00460b30(0x3e,&local_40);

  if ((cVar1 != '\0') && (iVar5 < local_40)) {

    iVar5 = local_40;

  }

  cVar1 = FUN_00460b30(0x3d,&local_3c);

  if ((cVar1 != '\0') && (local_3c < param_2)) {

    iVar6 = local_3c;

  }

  cVar1 = FUN_00460b30(0x3f,&local_38);

  if ((cVar1 != '\0') && (iVar6 < local_38)) {

    iVar6 = local_38;

  }

  if ((local_34 != iVar6) || (local_30 != iVar5)) {

    FUN_006a0740(iVar6,iVar5);

    piVar2 = (int *)param_1[0x2c];

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

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

        piVar2 = (int *)0x0;

      }

      else {

        piVar2 = (int *)FUN_004592b0();

      }

    }

    if ((*(byte *)((int)param_1 + 0x556) & 1) == 0) {

      FUN_00462270(0);

      FUN_006a0c10(1);

    }

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

      param_2 = 3;

      FUN_00461fb0(&param_2);

      if (param_2 == 3) {

        (**(code **)(*piVar2 + 0x10))(iVar6,iVar5);

        FUN_006a0c10(1);

      }

      param_3 = piVar2[8];

      iVar6 = piVar2[9];

      iVar5 = *piVar2;

      uVar3 = FUN_0069fe70();

      uVar3 = FUN_0069fe60(uVar3);

      (**(code **)(iVar5 + 0xc))(param_3,iVar6,uVar3);

      FUN_004620c0();

    }

    if ((((uint)param_1[0x155] >> 5 & 1) != 0) && (DAT_0083e03c != 0)) {

      FUN_0045b4c0(7,0);

    }

    if (((uint)param_1[0x155] >> 9 & 1) != 0) {

      iVar6 = param_1[0xb9];

      uVar3 = FUN_0069fe70();

      uVar4 = FUN_0069fe60();

      param_2 = FUN_0069fe70();

      uStack_14 = FUN_0069fe60();

      iStack_10 = param_2;

      uStack_20 = 0x24;

      uStack_1c = 0;

      uStack_18 = 0;

      uStack_4 = 0;

      iStack_28 = iVar6;

      piStack_24 = param_1;

      uStack_c = uVar4;

      uStack_8 = uVar3;

      if (DAT_0083e03c != 0) {

        FUN_0045ac50(&iStack_28);

      }

    }

    piStack_2c = param_1 + 0x2d;

    iVar6 = 0;

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

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

        iVar6 = 0;

      }

      else {

        iVar6 = param_1[0x49] + -8;

      }

    }

    for (; iVar6 != 0; iVar6 = *(int *)(iVar6 + 8) + -8) {

      if (*(int *)(iVar6 + 0x10) != 0) {

        FUN_00462720();

      }

      if (*(int *)(iVar6 + 8) == 0) break;

    }

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

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

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

    }

  }

  return;

}





// --- FUN_00463fb0 at 0x00463FB0 (size: 212) ---


void __fastcall FUN_00463fb0(int *param_1)



{

  int *piVar1;

  int iVar2;

  int iVar3;

  

  if (((*(byte *)((int)param_1 + 0x556) & 1) != 0) &&

     ((piVar1 = (int *)param_1[0x2c], piVar1 != (int *)0x0 ||

      ((param_1[0x2b] != 0 && (piVar1 = (int *)FUN_004592b0(), piVar1 != (int *)0x0)))))) {

    iVar2 = (**(code **)(*param_1 + 0xa0))();

    if (iVar2 == 0) {

      iVar2 = 0;

      iVar3 = 0;

    }

    else {

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

      iVar2 = FUN_0069fe00();

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

      iVar3 = FUN_0069fe30();

    }

    (**(code **)(*piVar1 + 0xc))(param_1[0x1f] + iVar2,param_1[0x20] + iVar3,piVar1[10],piVar1[0xb])

    ;

  }

  iVar2 = 0;

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

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

      iVar2 = 0;

    }

    else {

      iVar2 = param_1[0x49] + -8;

    }

  }

  while( true ) {

    if (iVar2 == 0) {

      return;

    }

    if (*(int **)(iVar2 + 0x10) != (int *)0x0) {

      (**(code **)(**(int **)(iVar2 + 0x10) + 0x114))();

    }

    if (*(int *)(iVar2 + 8) == 0) break;

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

  }

  return;

}





// --- FUN_00464110 at 0x00464110 (size: 34) ---


undefined4 __fastcall FUN_00464110(int param_1)



{

  int iVar1;

  

  if (((*(int *)(param_1 + 0x120) != 0) && (iVar1 = *(int *)(param_1 + 0x124), iVar1 != 0)) &&

     (iVar1 != 8)) {

    return *(undefined4 *)(iVar1 + 8);

  }

  return 0;

}





// --- FUN_00464140 at 0x00464140 (size: 143) ---


undefined4 * __thiscall FUN_00464140(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_0079cf54;

  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_004641d0 at 0x004641D0 (size: 310) ---


undefined4 __thiscall FUN_004641d0(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_004641d0(*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_0046421f;

      }

      piVar5 = *(int **)(param_1 + 100) + 1;

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

    }

    puVar11 = (uint *)0x0;

    puVar9 = (uint *)0x0;

LAB_0046421f:

    puVar7 = (uint *)*puVar11;

    if (puVar7 == puVar9) {

LAB_00464232:

      *puVar11 = puVar7[1];

    }

    else {

      do {

        puVar6 = puVar7;

        puVar7 = (uint *)puVar6[1];

      } while (puVar7 != puVar9);

      if (puVar6 == (uint *)0x0) goto LAB_00464232;

      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_00464310 at 0x00464310 (size: 202) ---


uint __thiscall FUN_00464310(int param_1,uint param_2)



{

  int iVar1;

  int iVar2;

  int iVar3;

  int iVar4;

  int *piVar5;

  

  if (param_2 == *(uint *)(param_1 + 0x68)) {

    return param_2 & 0xffffff00;

  }

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

  iVar1 = 0;

  do {

    if (iVar3 == 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(param_2);

      while (iVar1 != 0) {

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

        FUN_004648b0(iVar1);

        iVar1 = iVar3;

      }

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

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

        iVar4 = *piVar5;

        goto LAB_0046435e;

      }

      piVar5 = *(int **)(param_1 + 100) + 1;

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

    }

    piVar5 = (int *)0x0;

    iVar4 = 0;

LAB_0046435e:

    iVar3 = *piVar5;

    if (iVar3 == iVar4) {

LAB_00464371:

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

    }

    else {

      do {

        iVar2 = iVar3;

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

      } while (iVar3 != iVar4);

      if (iVar2 == 0) goto LAB_00464371;

      *(undefined4 *)(iVar2 + 4) = *(undefined4 *)(iVar3 + 4);

    }

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

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

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

    iVar1 = iVar4;

  } while( true );

}





// --- FUN_004643e0 at 0x004643E0 (size: 70) ---


undefined4 __thiscall FUN_004643e0(int param_1,uint param_2)



{

  uint *puVar1;

  

  puVar1 = *(uint **)(*(int *)(param_1 + 0x68) + (param_2 % *(uint *)(param_1 + 0x70)) * 4);

  while( true ) {

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

      return 0;

    }

    if (*puVar1 == param_2) break;

    puVar1 = (uint *)puVar1[1];

  }

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

    return 0;

  }

  return CONCAT31((int3)((uint)(puVar1 + 2) >> 8),puVar1 + 2 != (uint *)0x0);

}





// --- FUN_00464430 at 0x00464430 (size: 81) ---


bool __thiscall FUN_00464430(int param_1,undefined4 param_2)



{

  char cVar1;

  

  cVar1 = FUN_004643e0(param_2);

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

     ((*(int *)(param_1 + 0x404) == 0 || (cVar1 = FUN_0069d8d0(param_2), cVar1 == '\0')))) {

    cVar1 = FUN_0069d8d0(param_2);

    return cVar1 != '\0';

  }

  return true;

}





// --- FUN_00464490 at 0x00464490 (size: 81) ---


undefined4 __thiscall FUN_00464490(int param_1,uint param_2)



{

  uint *puVar1;

  uint uVar2;

  

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

                          ((param_2 << 0x18 | param_2 >> 8) % *(uint *)(param_1 + 0x11c)) * 4);

      (puVar1 != (uint *)0x0 && (*puVar1 != param_2)); puVar1 = (uint *)puVar1[1]) {

  }

  if (((puVar1 != (uint *)0x0) && (uVar2 = puVar1[2], uVar2 != 0)) && (uVar2 != 8)) {

    return *(undefined4 *)(uVar2 + 8);

  }

  return 0;

}





// --- FUN_004644f0 at 0x004644F0 (size: 81) ---


undefined4 __thiscall FUN_004644f0(int param_1,uint param_2)



{

  uint *puVar1;

  uint uVar2;

  

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

                          ((param_2 << 0x18 | param_2 >> 8) % *(uint *)(param_1 + 0x11c)) * 4);

      (puVar1 != (uint *)0x0 && (*puVar1 != param_2)); puVar1 = (uint *)puVar1[1]) {

  }

  if (((puVar1 != (uint *)0x0) && (uVar2 = puVar1[3], uVar2 != 0)) && (uVar2 != 8)) {

    return *(undefined4 *)(uVar2 + 8);

  }

  return 0;

}





// --- FUN_00464550 at 0x00464550 (size: 120) ---


uint __thiscall FUN_00464550(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_0046457b:

      if ((int)(*(uint *)(param_1 + 0x68) * 2) < *(int *)(param_1 + 0x6c) + 1) {

        FUN_00463750();

      }

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

    }

    puVar1 = (uint *)puVar1[1];

  } while( true );

}





// --- FUN_004645d0 at 0x004645D0 (size: 97) ---


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



{

  uint uVar1;

  uint *puVar2;

  uint uVar3;

  

  uVar1 = *param_2;

  uVar3 = (uVar1 << 0x18 | uVar1 >> 8) % *(uint *)(param_1 + 0x68);

  puVar2 = *(uint **)(*(int *)(param_1 + 0x60) + uVar3 * 4);

  while( true ) {

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

      return (uint *)0x0;

    }

    if (*puVar2 == uVar1) break;

    puVar2 = (uint *)puVar2[1];

  }

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

    return (uint *)0x0;

  }

  FUN_00428ba0(param_1,*(int *)(param_1 + 0x60) + uVar3 * 4,puVar2);

  return puVar2;

}





// --- FUN_00464640 at 0x00464640 (size: 73) ---


void __fastcall FUN_00464640(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_00464310(*puVar2);

  return;

}





// --- FUN_00464690 at 0x00464690 (size: 216) ---


int * __thiscall FUN_00464690(int *param_1,int *param_2)



{

  int iVar1;

  int iVar2;

  int *piVar3;

  int *piVar4;

  int *piVar5;

  int *piVar6;

  

  iVar2 = (int)param_2;

  piVar3 = (int *)FUN_00463c00(param_2);

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

    piVar4 = (int *)(**(code **)(*param_1 + 0xa0))();

    param_2 = param_1;

    do {

      piVar6 = piVar4;

      if (param_2[0xb9] == iVar2) {

        return param_2;

      }

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

        return piVar3;

      }

      if (((piVar6[0x48] != 0) && (iVar1 = piVar6[0x49], iVar1 != 0)) && (iVar1 != 8)) {

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

        while ((piVar4 != (int *)0x0 && (piVar3 == (int *)0x0))) {

          piVar5 = piVar4;

          if ((piVar4[0xb9] != iVar2) && (piVar5 = piVar3, piVar4 != param_2)) {

            piVar5 = (int *)FUN_00463c00(iVar2);

          }

          piVar4 = (int *)FUN_00464490(piVar4);

          piVar3 = piVar5;

        }

      }

      if (((uint)piVar6[0x155] >> 0x15 & 1) == 0) {

        piVar4 = (int *)(**(code **)(*piVar6 + 0xa0))();

      }

      else {

        piVar4 = (int *)0x0;

      }

      param_2 = piVar6;

    } while (piVar3 == (int *)0x0);

  }

  return piVar3;

}





// --- FUN_00464770 at 0x00464770 (size: 111) ---


undefined4 __thiscall FUN_00464770(int param_1,uint *param_2)



{

  uint *puVar1;

  

  puVar1 = *(uint **)(*(int *)(param_1 + 100) + (*param_2 % *(uint *)(param_1 + 0x6c)) * 4);

  do {

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

LAB_0046479b:

      puVar1 = (uint *)FUN_005df0f5(8);

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

        *puVar1 = *param_2;

        puVar1[1] = 0;

        FUN_00464550(puVar1);

        return 1;

      }

      FUN_00464550(0);

      return 1;

    }

    if (*puVar1 == *param_2) {

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

        return 0;

      }

      goto LAB_0046479b;

    }

    puVar1 = (uint *)puVar1[1];

  } while( true );

}





// --- FUN_004647e0 at 0x004647E0 (size: 82) ---


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



{

  *param_1 = &PTR_FUN_0079cf58;

  FUN_005870f0();

  param_1[1] = &PTR_FUN_0079cf54;

  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_00464840 at 0x00464840 (size: 99) ---


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



{

  uint uVar1;

  uint *puVar2;

  

  uVar1 = *param_2;

  puVar2 = *(uint **)(*(int *)(param_1 + 0x60) +

                     ((uVar1 << 0x18 | uVar1 >> 8) % *(uint *)(param_1 + 0x68)) * 4);

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

    while (*puVar2 != uVar1) {

      puVar2 = (uint *)puVar2[1];

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

        return (uint *)0x0;

      }

    }

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

      FUN_00410880(puVar2 + 2);

      FUN_004645d0(param_2);

    }

  }

  return puVar2;

}





// --- FUN_004648b0 at 0x004648B0 (size: 78) ---


void __thiscall FUN_004648b0(int param_1,uint *param_2)



{

  int iVar1;

  uint uVar2;

  

  if (*(int *)(param_1 + 0x68) * 2 < *(int *)(param_1 + 0x6c) + 1) {

    FUN_00464640();

  }

  uVar2 = (*param_2 << 0x18 | *param_2 >> 8) % *(uint *)(param_1 + 0x68);

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

  param_2[1] = *(uint *)(iVar1 + uVar2 * 4);

  *(uint **)(iVar1 + uVar2 * 4) = param_2;

  uVar2 = iVar1 + uVar2 * 4;

  if (uVar2 < *(uint *)(param_1 + 100)) {

    *(uint *)(param_1 + 100) = uVar2;

  }

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

  return;

}





// --- FUN_00464900 at 0x00464900 (size: 373) ---


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



{

  int iVar1;

  int *piVar2;

  

  FUN_006a0f70(0,0,0,0,0);

  *param_1 = (int)&PTR_FUN_0079cf60;

  param_1[0x68] = 0;

  param_1[0x69] = 0;

  FUN_00465bf0();

  param_1[0x8e] = 0;

  FUN_0069c3b0(param_3);

  param_1[0x100] = 0;

  param_1[0x101] = 0;

  FUN_006823d0();

  param_1[0x120] = 0;

  FUN_006791d0();

  FUN_0042dc80();

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

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

  param_1[0x152] = 0;

  param_1[0x153] = 0;

  param_1[0x154] = DAT_0083e1c8;

  param_1[0x155] = 0;

  param_1[0x156] = 0;

  param_1[0x157] = 0;

  param_1[0x158] = 0;

  param_1[0x159] = 0;

  param_1[0x15a] = 0;

  param_1[0x15b] = (int)&PTR_FUN_0079cf58;

  FUN_00464140(0x17);

  param_1[0x178] = 0;

  param_1[0x179] = 0;

  param_1[0x17a] = 0;

  param_1[0x17b] = 0;

  param_1[0x8e] = (int)param_2;

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

  FUN_004634c0(param_1[0x93],param_1[0x94]);

  FUN_00463d60(param_1[0x95],param_1[0x96]);

  iVar1 = param_1[0x97];

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

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

    param_1[0x25] = iVar1;

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

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

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

    }

  }

  param_1[0x127] = (int)FUN_004154a0;

  param_1[0x89] = (int)param_1;

  return param_1;

}





// --- FUN_00464ad0 at 0x00464AD0 (size: 33) ---


void __fastcall FUN_00464ad0(undefined4 param_1)



{

  FUN_00464770(&stack0x00000004);

  FUN_00466470(param_1);

  return;

}





// --- FUN_00464b00 at 0x00464B00 (size: 75) ---


void __thiscall FUN_00464b00(int param_1,int param_2)



{

  void *pvVar1;

  

  if ((*(int **)(param_1 + 0x5e8) != (int *)0x0) && (**(int **)(param_1 + 0x5e8) == param_2)) {

    FUN_00429ca0();

  }

  pvVar1 = (void *)FUN_004171e0(&param_2);

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

    operator_delete(pvVar1);

  }

  FUN_00466480(param_1);

  return;

}





// --- FUN_00464b50 at 0x00464B50 (size: 116) ---


void __fastcall FUN_00464b50(int param_1)



{

  int iVar1;

  undefined4 *puVar2;

  int *piVar3;

  

  do {

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

      return;

    }

    piVar3 = *(int **)(param_1 + 0x70);

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

LAB_00464ba7:

      piVar3 = (int *)0x0;

    }

    else {

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

        iVar1 = *piVar3;

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

        if (iVar1 != 0) {

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

        }

      }

      else {

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

      }

      if (*piVar3 == 0) {

        puVar2 = *(undefined4 **)(*(int *)(param_1 + 0x74) + 4);

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

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

          *puVar2 = 0;

        }

      }

      else {

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

      }

      *piVar3 = 0;

      piVar3[1] = 0;

      if (piVar3 == (int *)0x0) goto LAB_00464ba7;

      piVar3 = piVar3 + -2;

    }

    FUN_004645d0(piVar3);

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

      operator_delete(piVar3);

    }

  } while( true );

}





// --- FUN_00464bd0 at 0x00464BD0 (size: 72) ---


undefined4 __thiscall FUN_00464bd0(int param_1,uint *param_2)



{

  uint uVar1;

  uint *puVar2;

  

  uVar1 = *param_2;

  puVar2 = *(uint **)(*(int *)(param_1 + 0x60) +

                     ((uVar1 << 0x18 | uVar1 >> 8) % *(uint *)(param_1 + 0x68)) * 4);

  do {

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

LAB_00464c00:

      FUN_004648b0(param_2);

      return 1;

    }

    if (*puVar2 == uVar1) {

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

        return 0;

      }

      goto LAB_00464c00;

    }

    puVar2 = (uint *)puVar2[1];

  } while( true );

}





// --- FUN_00464c20 at 0x00464C20 (size: 99) ---


undefined4 __thiscall FUN_00464c20(int param_1,uint *param_2)



{

  uint uVar1;

  uint *puVar2;

  

  uVar1 = *param_2;

  puVar2 = *(uint **)(*(int *)(param_1 + 0x60) +

                     ((uVar1 << 0x18 | uVar1 >> 8) % *(uint *)(param_1 + 0x68)) * 4);

  do {

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

LAB_00464c52:

      FUN_00464bd0(param_2);

LAB_00464c5a:

      FUN_00410820(param_2 + 2,*(undefined4 *)(param_1 + 0x74));

      return 1;

    }

    if (*puVar2 == uVar1) {

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

        FUN_00410880(param_2 + 2);

        goto LAB_00464c5a;

      }

      goto LAB_00464c52;

    }

    puVar2 = (uint *)puVar2[1];

  } while( true );

}





// --- FUN_00464c90 at 0x00464C90 (size: 62) ---


char __thiscall FUN_00464c90(int *param_1,undefined4 param_2)



{

  undefined4 uVar1;

  char cVar2;

  

  uVar1 = param_2;

  param_2 = FUN_00429a00();

  cVar2 = FUN_00429120(&param_2,uVar1);

  if (cVar2 != '\0') {

    (**(code **)(*param_1 + 200))(uVar1);

  }

  return cVar2;

}





// --- FUN_00464cd0 at 0x00464CD0 (size: 90) ---


void __fastcall FUN_00464cd0(int param_1)



{

  undefined4 *puVar1;

  int *piVar2;

  

  piVar2 = (int *)0x0;

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

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

      piVar2 = (int *)0x0;

    }

    else {

      piVar2 = (int *)(*(int *)(param_1 + 0x124) + -8);

    }

  }

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

    puVar1 = (undefined4 *)*piVar2;

    if (piVar2[2] == 0) {

      piVar2 = (int *)0x0;

    }

    else {

      piVar2 = (int *)(piVar2[2] + -8);

    }

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

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

    }

  }

  FUN_00464b50();

  return;

}





// --- FUN_00464d30 at 0x00464D30 (size: 73) ---


undefined4 __thiscall FUN_00464d30(int param_1,uint *param_2)



{

  uint uVar1;

  uint *puVar2;

  undefined4 uVar3;

  

  uVar1 = *param_2;

  puVar2 = *(uint **)(*(int *)(param_1 + 0x60) +

                     ((uVar1 << 0x18 | uVar1 >> 8) % *(uint *)(param_1 + 0x68)) * 4);

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

    while (*puVar2 != uVar1) {

      puVar2 = (uint *)puVar2[1];

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

        return 0;

      }

    }

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

      uVar3 = FUN_00464c20();

      return uVar3;

    }

  }

  return 0;

}





// --- FUN_00464d80 at 0x00464D80 (size: 92) ---


undefined4 __thiscall FUN_00464d80(int param_1,uint *param_2)



{

  uint uVar1;

  uint *puVar2;

  

  uVar1 = *param_2;

  puVar2 = *(uint **)(*(int *)(param_1 + 0x60) +

                     ((uVar1 << 0x18 | uVar1 >> 8) % *(uint *)(param_1 + 0x68)) * 4);

  do {

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

LAB_00464db2:

      FUN_00464bd0(param_2);

      FUN_00410820(param_2 + 2,*(undefined4 *)(param_1 + 0x74));

      return 1;

    }

    if (*puVar2 == uVar1) {

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

        return 0;

      }

      goto LAB_00464db2;

    }

    puVar2 = (uint *)puVar2[1];

  } while( true );

}





// --- FUN_00464de0 at 0x00464DE0 (size: 30) ---


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



{

  FUN_00681f60();

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

    operator_delete(param_1);

  }

  return param_1;

}





// --- FUN_00464e00 at 0x00464E00 (size: 401) ---


void __fastcall FUN_00464e00(undefined4 *param_1)



{

  int iVar1;

  int *piVar2;

  int *piVar3;

  int *piVar4;

  int *piVar5;

  int *piVar6;

  int *piVar7;

  undefined1 local_c [12];

  

  *param_1 = &PTR_FUN_0079cf60;

  iVar1 = DAT_0083e03c;

  FUN_00464cd0();

  if (((uint)param_1[0x155] >> 0x12 & 1) != 0) {

    param_1[0x155] = param_1[0x155] & 0xfffbffff;

  }

  if (((uint)param_1[0x155] >> 0x13 & 1) != 0) {

    FUN_0045fe40();

  }

  piVar7 = (int *)0x0;

  if (iVar1 != 0) {

    FUN_0045e600(param_1);

  }

  FUN_00461ba0(0);

  FUN_00462b30(0);

  piVar3 = (int *)FUN_0052dcf0(local_c);

  iVar1 = *piVar3;

  piVar2 = (int *)piVar3[2];

  piVar3 = (int *)piVar3[1];

  do {

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

      if ((int *)param_1[0x8e] != piVar7) {

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

        param_1[0x8e] = piVar7;

      }

      param_1[0x15b] = &PTR_FUN_0079cf58;

      FUN_005870f0();

      param_1[0x15c] = &PTR_FUN_0079cf54;

      if ((undefined4 *)param_1[0x174] != param_1 + 0x15d) {

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

      }

      param_1[0x174] = piVar7;

      param_1[0x175] = piVar7;

      param_1[0x176] = piVar7;

      param_1[0x177] = piVar7;

      FUN_0042e590();

      FUN_00681f60();

      FUN_0069c0c0();

      FUN_00465e30();

      FUN_006a1070();

      return;

    }

    piVar5 = (int *)piVar2[1];

    piVar6 = piVar3;

    piVar7 = piVar5;

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

      do {

        piVar6 = piVar6 + 1;

        piVar7 = piVar5;

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

        piVar7 = (int *)*piVar6;

      } while (piVar7 == (int *)0x0);

    }

    piVar5 = (int *)*piVar3;

    if (piVar5 == piVar2) {

LAB_00464ecd:

      *piVar3 = piVar5[1];

    }

    else {

      do {

        piVar4 = piVar5;

        piVar5 = (int *)piVar4[1];

      } while (piVar5 != piVar2);

      if (piVar4 == (int *)0x0) goto LAB_00464ecd;

      piVar4[1] = piVar5[1];

    }

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

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

      operator_delete(piVar2);

    }

    FUN_00466480(param_1);

    piVar2 = piVar7;

    piVar3 = piVar6;

  } while( true );

}





// --- FUN_00464fa0 at 0x00464FA0 (size: 900) ---


undefined4 __thiscall FUN_00464fa0(int *param_1,int param_2)



{

  int iVar1;

  uint uVar2;

  uint *puVar3;

  int iVar4;

  char cVar5;

  int *piVar6;

  uint *puVar7;

  undefined4 *puVar8;

  undefined4 *local_108;

  undefined4 *local_104;

  int local_100;

  undefined1 local_fc [4];

  int *local_f8;

  undefined **local_f0;

  undefined **local_ec;

  int local_88;

  int *local_84;

  uint local_80;

  undefined **local_78;

  undefined **local_74;

  int iStack_10;

  uint uStack_8;

  

  local_108 = (undefined4 *)param_1[0x101];

  local_100 = FUN_0069bad0(param_2);

  if (local_100 == 0) {

    param_2 = 0;

  }

  if (param_2 != param_1[0x100]) {

    param_1[0x101] = local_100;

    param_1[0x100] = param_2;

    if (local_100 == 0) {

      cVar5 = *(char *)((int)param_1 + 0x249);

    }

    else {

      cVar5 = *(char *)(local_100 + 0xd);

    }

    if (cVar5 != '\0') {

      local_f8 = param_1 + 0x2d;

      piVar6 = (int *)0x0;

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

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

          piVar6 = (int *)0x0;

        }

        else {

          piVar6 = (int *)(param_1[0x49] + -8);

        }

      }

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

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

          (**(code **)(*(int *)*piVar6 + 0x9c))(param_2);

        }

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

      }

    }

    local_78 = &PTR_FUN_0079d098;

    local_74 = &PTR_FUN_00798700;

    FUN_00428580(0);

    local_74 = &PTR_FUN_00798700;

    FUN_00682400(param_1 + 0x98);

    local_ec = &PTR_FUN_00798700;

    local_f0 = &PTR_FUN_0079d098;

    FUN_00428580(0);

    local_ec = &PTR_FUN_00798700;

    FUN_00682400(param_1 + 0x98);

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

      FUN_006817e0(local_108 + 9,1);

    }

    if (local_100 != 0) {

      FUN_006817e0(local_100 + 0x24,1);

    }

    FUN_006817e0(param_1 + 0x102,1);

    FUN_006817e0(param_1 + 0x102,1);

    piVar6 = (int *)FUN_0052dcf0(local_fc);

    puVar7 = (uint *)piVar6[2];

    iVar1 = *piVar6;

    puVar8 = (undefined4 *)piVar6[1];

    while (puVar7 != (uint *)0x0) {

      do {

        local_108 = (undefined4 *)0x0;

        local_104 = (undefined4 *)0x0;

        uVar2 = *puVar7;

        for (puVar3 = *(uint **)(local_88 + (uVar2 % local_80) * 4); puVar3 != (uint *)0x0;

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

          if (*puVar3 == uVar2) {

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

              FUN_00429ab0(puVar3 + 2);

              cVar5 = FUN_004299b0(puVar7 + 2);

              if (cVar5 != '\0') goto LAB_00465180;

              goto LAB_0046516f;

            }

            break;

          }

        }

        FUN_0042a2d0(uVar2);

LAB_0046516f:

        (**(code **)(*param_1 + 200))(&local_108);

LAB_00465180:

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

          iVar4 = local_108[1];

          local_108[1] = iVar4 + -1;

          if (iVar4 + -1 == 0) {

            (**(code **)*local_108)(1);

          }

          local_108 = (undefined4 *)0x0;

        }

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

          iVar4 = local_104[1];

          local_104[1] = iVar4 + -1;

          if (iVar4 + -1 == 0) {

            (**(code **)*local_104)(1);

          }

          local_104 = (undefined4 *)0x0;

        }

        puVar7 = (uint *)puVar7[1];

      } while (puVar7 != (uint *)0x0);

      do {

        puVar8 = puVar8 + 1;

        if (puVar8 == (undefined4 *)(*(int *)(iVar1 + 0x60) + *(int *)(iVar1 + 0x68) * 4))

        goto LAB_004651ed;

        puVar7 = (uint *)*puVar8;

      } while (puVar7 == (uint *)0x0);

    }

LAB_004651ed:

    for (; local_84 != (int *)(local_88 + local_80 * 4); local_84 = local_84 + 1) {

      if (*local_84 != 0) {

        puVar7 = (uint *)*local_84;

        piVar6 = local_84;

        goto joined_r0x0046525d;

      }

    }

    puVar7 = (uint *)0x0;

    piVar6 = (int *)0x0;

joined_r0x0046525d:

    while (puVar7 != (uint *)0x0) {

      do {

        for (puVar3 = *(uint **)(iStack_10 + (*puVar7 % uStack_8) * 4); puVar3 != (uint *)0x0;

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

          if (*puVar3 == *puVar7) {

            if ((puVar3 != (uint *)0x0) && (puVar3 != (uint *)0xfffffff8)) goto LAB_004652a8;

            break;

          }

        }

        (**(code **)(*param_1 + 200))(puVar7 + 2);

LAB_004652a8:

        puVar7 = (uint *)puVar7[1];

      } while (puVar7 != (uint *)0x0);

      do {

        piVar6 = piVar6 + 1;

        if (piVar6 == (int *)(local_88 + local_80 * 4)) goto LAB_004652d3;

        puVar7 = (uint *)*piVar6;

      } while (puVar7 == (uint *)0x0);

    }

LAB_004652d3:

    if (local_100 == 0) {

      param_1 = param_1 + 0xb6;

    }

    else {

      param_1 = (int *)(local_100 + 0x9c);

    }

    if (param_1[2] != 0) {

      FUN_00465ec0(param_1);

    }

    FUN_00681f60();

    FUN_00681f60();

  }

  return 1;

}





// --- FUN_00465330 at 0x00465330 (size: 540) ---


void __thiscall FUN_00465330(int *param_1,int param_2)



{

  int *piVar1;

  int iVar2;

  undefined4 uVar3;

  int iVar4;

  int iVar5;

  undefined1 local_84 [4];

  int *piStack_80;

  undefined **local_78;

  undefined **local_74;

  

  local_78 = &PTR_FUN_0079d098;

  local_74 = &PTR_FUN_00798700;

  FUN_00428580(0);

  local_74 = &PTR_FUN_00798700;

  FUN_00682400(param_2 + 0x408);

  piVar1 = (int *)FUN_0052dcf0(local_84);

  iVar2 = piVar1[2];

  iVar5 = *piVar1;

  piVar1 = (int *)piVar1[1];

  while (iVar2 != 0) {

    do {

      (**(code **)(*param_1 + 0xd4))(iVar2 + 8);

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

    } while (iVar2 != 0);

    do {

      piVar1 = piVar1 + 1;

      if (piVar1 == (int *)(*(int *)(iVar5 + 0x60) + *(int *)(iVar5 + 0x68) * 4)) goto LAB_004653c3;

      iVar2 = *piVar1;

    } while (iVar2 == 0);

  }

LAB_004653c3:

  FUN_00465ec0(param_2 + 0x228);

  if (((param_1[0x8c] == 0) && (*(int *)(param_2 + 0x98) != 0)) &&

     (iVar5 = *(int *)(*(int *)(param_2 + 0x98) + 8), iVar5 != 0)) {

    FUN_006a0660();

    iVar2 = FUN_005df0f5(0xc);

    if (iVar2 == 0) {

      uVar3 = 0;

    }

    else {

      uVar3 = FUN_00694d80(iVar5);

    }

    FUN_006a0610(uVar3);

  }

  piStack_80 = param_1 + 0x2d;

  iVar5 = 0;

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

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

      iVar5 = 0;

    }

    else {

      iVar5 = param_1[0x49] + -8;

    }

  }

  for (; iVar5 != 0; iVar5 = *(int *)(iVar5 + 8) + -8) {

    piVar1 = *(int **)(iVar5 + 0x10);

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

      iVar2 = FUN_00463ba0(piVar1[0xb9]);

      if (iVar2 == 0) {

        if (DAT_0083e03c != 0) {

          FUN_0045b350(piVar1);

        }

      }

      else {

        (**(code **)(*piVar1 + 0xf0))(iVar2);

      }

    }

    if (*(int *)(iVar5 + 8) == 0) break;

  }

  if (DAT_0083e03c != 0) {

    piStack_80 = (int *)(param_2 + 0xb4);

    iVar5 = 0;

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

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

        iVar5 = 0;

      }

      else {

        iVar5 = *(int *)(param_2 + 0x124) + -8;

      }

    }

    for (; iVar5 != 0; iVar5 = *(int *)(iVar5 + 8) + -8) {

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

      if (((iVar2 != 0) && (iVar4 = FUN_00463ba0(*(undefined4 *)(iVar2 + 0x2e4)), iVar4 == 0)) &&

         ((*(int *)(iVar2 + 0x238) != 0 &&

          (piVar1 = (int *)FUN_0045d160(param_1,*(int *)(iVar2 + 0x238),iVar2 + 0x23c),

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

        (**(code **)(*piVar1 + 0xf0))(iVar2);

      }

      if (*(int *)(iVar5 + 8) == 0) break;

    }

    (**(code **)(*param_1 + 0x9c))(*(undefined4 *)(param_2 + 0x400));

  }

  FUN_00681f60();

  return;

}





// --- FUN_00465550 at 0x00465550 (size: 155) ---


char __thiscall FUN_00465550(int param_1,uint *param_2,uint *param_3)



{

  uint uVar1;

  char cVar2;

  uint *puVar3;

  

  uVar1 = *param_2;

  puVar3 = *(uint **)(*(int *)(param_1 + 0x60) +

                     ((uVar1 << 0x18 | uVar1 >> 8) % *(uint *)(param_1 + 0x68)) * 4);

  do {

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

LAB_00465580:

      puVar3 = (uint *)FUN_005df0f5(0x14);

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

        puVar3 = (uint *)0x0;

      }

      else {

        *puVar3 = *param_2;

        puVar3[1] = 0;

        puVar3[2] = 0;

        puVar3[3] = 0;

        puVar3[4] = *param_3;

      }

      cVar2 = FUN_00464d80(puVar3);

      if ((cVar2 == '\0') && (puVar3 != (uint *)0x0)) {

        operator_delete(puVar3);

      }

      return cVar2;

    }

    if (*puVar3 == uVar1) {

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

        cVar2 = FUN_00464d30(param_2);

        return cVar2;

      }

      goto LAB_00465580;

    }

    puVar3 = (uint *)puVar3[1];

  } while( true );

}





// --- FUN_004655f0 at 0x004655F0 (size: 30) ---


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



{

  FUN_00464e00();

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

    operator_delete(param_1);

  }

  return param_1;

}





// --- FUN_00465610 at 0x00465610 (size: 61) ---


void FUN_00465610(undefined4 param_1)



{

  void *pvVar1;

  

  pvVar1 = (void *)FUN_00464840(&param_1);

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

    operator_delete(pvVar1);

    FUN_00465550(&param_1,&param_1);

  }

  return;

}





// --- FUN_00465650 at 0x00465650 (size: 133) ---


uint __thiscall FUN_00465650(int param_1,int param_2)



{

  double dVar1;

  double dVar2;

  ushort uVar3;

  undefined4 uVar4;

  uint in_EAX;

  undefined2 extraout_var;

  undefined2 extraout_var_00;

  undefined2 uVar5;

  float10 fVar6;

  

  if ((param_2 != 0) && (in_EAX = 0, *(int *)(param_1 + 0x7c) != 0)) {

    fVar6 = (float10)FUN_0040faa0();

    dVar1 = (double)fVar6;

    uVar5 = extraout_var;

    if (*(double *)(param_2 + 0x10) == (double)CONCAT44(DAT_0079d0e4,DAT_0079d0e0)) {

      fVar6 = (float10)FUN_0042c860(*(undefined4 *)(param_2 + 8),*(undefined4 *)(param_2 + 0xc));

      *(double *)(param_2 + 0x10) = (double)(fVar6 + (float10)dVar1);

      uVar5 = extraout_var_00;

    }

    uVar4 = DAT_0079d0e4;

    dVar2 = *(double *)(param_2 + 0x10);

    uVar3 = (ushort)(dVar1 < dVar2);

    if (uVar3 == 0) {

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

      *(undefined4 *)(param_2 + 0x14) = uVar4;

    }

    return CONCAT31((int3)(CONCAT22(uVar5,uVar3 << 8 | (ushort)(NAN(dVar1) || NAN(dVar2)) << 10 |

                                          (ushort)(dVar1 == dVar2) << 0xe) >> 8),uVar3 == 0);

  }

  return in_EAX & 0xffffff00;

}





// --- FUN_004656e0 at 0x004656E0 (size: 76) ---


uint __thiscall FUN_004656e0(int param_1,int param_2)



{

  float fVar1;

  float10 fVar2;

  uint in_EAX;

  undefined2 extraout_var;

  float10 fVar3;

  

  if ((param_2 != 0) && (in_EAX = 0, *(int *)(param_1 + 0x7c) != 0)) {

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

    fVar3 = (float10)FUN_0042c860(0,0x3f800000);

    fVar2 = (float10)fVar1;

    if (fVar3 < fVar2 != (fVar3 == fVar2)) {

      *(int *)(param_1 + 0x8c) = *(int *)(param_2 + 8) + -1;

    }

    return CONCAT31((int3)(CONCAT22(extraout_var,

                                    (ushort)(fVar3 < fVar2) << 8 |

                                    (ushort)(NAN(fVar3) || NAN(fVar2)) << 10 |

                                    (ushort)(fVar3 == fVar2) << 0xe) >> 8),1);

  }

  return in_EAX & 0xffffff00;

}





// --- FUN_00465730 at 0x00465730 (size: 95) ---


undefined4 __thiscall FUN_00465730(int param_1,int param_2)



{

  float fVar1;

  float10 fVar2;

  

  if (((param_2 != 0) && (*(int *)(param_1 + 0x7c) != 0)) &&

     ((*(uint *)(*(int *)(param_1 + 0x7c) + 0x554) >> 0x11 & 1) != 0)) {

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

    fVar2 = (float10)FUN_0042c860(0,0x3f800000);

    if (fVar2 < (float10)fVar1 != (fVar2 == (float10)fVar1)) {

      FUN_00460410(*(undefined4 *)(param_2 + 8),0,0);

    }

    return 1;

  }

  return 0;

}





// --- FUN_00465790 at 0x00465790 (size: 74) ---


uint __thiscall FUN_00465790(int param_1,int param_2)



{

  float fVar1;

  float10 fVar2;

  uint in_EAX;

  undefined2 extraout_var;

  float10 fVar3;

  

  if ((param_2 != 0) && (in_EAX = 0, *(int *)(param_1 + 0x7c) != 0)) {

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

    fVar3 = (float10)FUN_0042c860(0,0x3f800000);

    fVar2 = (float10)fVar1;

    in_EAX = CONCAT22(extraout_var,

                      (ushort)(fVar3 < fVar2) << 8 | (ushort)(NAN(fVar3) || NAN(fVar2)) << 10 |

                      (ushort)(fVar3 == fVar2) << 0xe);

    if (fVar3 < fVar2 != (fVar3 == fVar2)) {

      in_EAX = (**(code **)(**(int **)(param_1 + 0x7c) + 0x9c))(*(undefined4 *)(param_2 + 8));

    }

  }

  return in_EAX & 0xffffff00;

}





// --- FUN_004657e0 at 0x004657E0 (size: 45) ---


uint __thiscall FUN_004657e0(uint param_1,int param_2)



{

  uint uVar1;

  

  if (((param_2 != 0) && (param_1 = *(uint *)(param_1 + 0x7c), param_1 != 0)) &&

     ((*(uint *)(param_1 + 0x554) >> 0x11 & 1) != 0)) {

    uVar1 = FUN_0069de50();

    return uVar1;

  }

  return param_1 & 0xffffff00;

}





// --- FUN_00465810 at 0x00465810 (size: 327) ---


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



bool __thiscall FUN_00465810(int param_1,int *param_2)



{

  bool bVar1;

  int *piVar2;

  double dVar3;

  double *pdVar4;

  double *pdVar5;

  int iVar6;

  float10 fVar7;

  double local_8;

  

  piVar2 = param_2;

  if ((param_2 != (int *)0x0) && (*(int *)(param_1 + 0x7c) != 0)) {

    fVar7 = (float10)FUN_0040faa0();

    local_8 = (double)fVar7;

    if (*(double *)(piVar2 + 8) == (double)CONCAT44(DAT_0079d0e4,DAT_0079d0e0)) {

      *(double *)(piVar2 + 8) = (double)fVar7;

      piVar2[10] = -1;

    }

    fVar7 = (float10)(**(code **)(*piVar2 + 100))();

    dVar3 = local_8;

    if (ABS(fVar7) < (float10)_DAT_0079d0f8 == (ABS(fVar7) == (float10)_DAT_0079d0f8)) {

      fVar7 = ((float10)local_8 - (float10)*(double *)(piVar2 + 8)) / fVar7;

    }

    else {

      fVar7 = (float10)DAT_00796344;

    }

    local_8 = (double)((ulonglong)local_8 & 0xffffffff00000000);

    pdVar4 = &local_8;

    if ((float10)DAT_00796344 <= fVar7) {

      pdVar4 = (double *)&param_2;

    }

    local_8._4_4_ = SUB84(dVar3,4);

    local_8 = (double)CONCAT44(local_8._4_4_,0x3f800000);

    pdVar5 = &local_8;

    if (*(float *)pdVar4 <= _DAT_007938b0) {

      pdVar5 = (double *)&param_2;

    }

    param_2 = *(int **)pdVar5;

    if (piVar2[6] != 0) {

      local_8 = (double)CONCAT44(local_8._4_4_,piVar2[6] + -1);

      iVar6 = FUN_005df4c4();

      if (iVar6 != piVar2[10]) {

        FUN_006a07e0(*(undefined4 *)(piVar2[4] + iVar6 * 4),piVar2[3]);

        piVar2[10] = iVar6;

      }

    }

    iVar6 = DAT_0079d0e0;

    bVar1 = (float)param_2 == _DAT_007938b0;

    if (bVar1) {

      piVar2[9] = DAT_0079d0e4;

      piVar2[8] = iVar6;

      piVar2[10] = -1;

    }

    return bVar1;

  }

  return false;

}





// --- FUN_00465960 at 0x00465960 (size: 52) ---


undefined4 __thiscall FUN_00465960(int param_1,int param_2)



{

  if ((param_2 != 0) && (*(int *)(param_1 + 0x7c) != 0)) {

    if (*(int *)(param_2 + 8) != DAT_0083e2ac) {

      FUN_0069feb0(*(int *)(param_2 + 8));

      return 1;

    }

    FUN_0069fbd0();

    return 1;

  }

  return 0;

}





// --- FUN_004659a0 at 0x004659A0 (size: 56) ---


undefined4 __thiscall FUN_004659a0(int param_1,int param_2)



{

  if ((param_2 != 0) && (*(int *)(param_1 + 0x7c) != 0)) {

    if (*(int *)(param_2 + 8) == DAT_0083e2ac) {

      FUN_006a0660();

      return 1;

    }

    FUN_006a07e0(*(int *)(param_2 + 8),*(undefined4 *)(param_2 + 0xc));

    return 1;

  }

  return 0;

}





// --- FUN_004659e0 at 0x004659E0 (size: 115) ---


undefined4 __thiscall FUN_004659e0(int param_1,int param_2)



{

  undefined4 uVar1;

  int iVar2;

  

  if ((param_2 != 0) && (*(int *)(param_1 + 0x7c) != 0)) {

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

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

        FUN_005515f0(*(int *)(param_2 + 8),0x3f800000);

      }

    }

    else {

      uVar1 = FUN_004220b0(*(undefined4 *)(param_2 + 8),0x22);

      iVar2 = FUN_00415430(uVar1);

      if (iVar2 != 0) {

        FUN_00551560(*(undefined4 *)(param_2 + 0xc),iVar2);

        return 1;

      }

    }

    return 1;

  }

  return 0;

}





// --- FUN_00465a60 at 0x00465A60 (size: 334) ---


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



bool __thiscall FUN_00465a60(int param_1,int *param_2)



{

  bool bVar1;

  int iVar2;

  int *piVar3;

  double dVar4;

  int *piVar5;

  float *pfVar6;

  float *pfVar7;

  float10 fVar8;

  undefined8 local_8;

  

  piVar3 = param_2;

  if ((param_2 == (int *)0x0) || (*(int *)(param_1 + 0x7c) == 0)) {

    return false;

  }

  fVar8 = (float10)FUN_0040faa0();

  local_8 = (double)fVar8;

  piVar5 = *(int **)(*(int *)(param_1 + 0x7c) + 0xb0);

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

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

      piVar5 = (int *)FUN_004592b0();

      goto LAB_00465aa9;

    }

  }

  else {

LAB_00465aa9:

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

      piVar5 = (int *)(**(code **)(*piVar5 + 0x1c))();

      goto LAB_00465aba;

    }

  }

  piVar5 = (int *)0x0;

LAB_00465aba:

  if (*(double *)(piVar3 + 6) == (double)CONCAT44(DAT_0079d0e4,DAT_0079d0e0)) {

    piVar3[6] = (int)(float)local_8;

    piVar3[7] = local_8._4_4_;

  }

  fVar8 = (float10)(**(code **)(*piVar3 + 100))();

  dVar4 = local_8;

  if (ABS(fVar8) < (float10)_DAT_0079d0f8 == (ABS(fVar8) == (float10)_DAT_0079d0f8)) {

    fVar8 = ((float10)local_8 - (float10)*(double *)(piVar3 + 6)) / fVar8;

  }

  else {

    fVar8 = (float10)_DAT_007938b0;

  }

  local_8 = (double)((ulonglong)local_8 & 0xffffffff00000000);

  pfVar6 = (float *)&local_8;

  if ((float10)DAT_00796344 <= fVar8) {

    pfVar6 = (float *)&param_2;

  }

  local_8._4_4_ = SUB84(dVar4,4);

  local_8 = (double)CONCAT44(local_8._4_4_,0x3f800000);

  pfVar7 = (float *)&local_8;

  if (*pfVar6 <= _DAT_007938b0) {

    pfVar7 = (float *)&param_2;

  }

  param_2 = (int *)*pfVar7;

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

    (**(code **)(*piVar5 + 0x48))

              (((float)piVar3[3] - (float)piVar3[2]) * (float)param_2 + (float)piVar3[2]);

  }

  iVar2 = DAT_0079d0e0;

  bVar1 = (float)param_2 == _DAT_007938b0;

  if (bVar1) {

    piVar3[7] = DAT_0079d0e4;

    piVar3[6] = iVar2;

  }

  return bVar1;

}





// --- FUN_00465bb0 at 0x00465BB0 (size: 63) ---


undefined4 __thiscall FUN_00465bb0(int param_1,int param_2)



{

  if ((param_2 != 0) && (*(int *)(param_1 + 0x7c) != 0)) {

    if (*(int *)(param_2 + 8) != DAT_0083e2ac) {

      FUN_00460030(*(int *)(param_2 + 8),*(undefined4 *)(param_2 + 0xc),

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

      return 1;

    }

    FUN_00460060();

    return 1;

  }

  return 0;

}





// --- FUN_00465bf0 at 0x00465BF0 (size: 47) ---


undefined4 * __fastcall FUN_00465bf0(undefined4 *param_1)



{

  FUN_00466380();

  param_1[0x1f] = 0;

  *param_1 = &PTR_FUN_0079d0fc;

  param_1[0x20] = 0;

  param_1[0x21] = 0;

  param_1[0x22] = 0;

  param_1[0x23] = 0;

  return param_1;

}





// --- FUN_00465c20 at 0x00465C20 (size: 156) ---


void __fastcall FUN_00465c20(int param_1)



{

  undefined4 *puVar1;

  int iVar2;

  uint uVar3;

  

  uVar3 = 0;

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

    do {

      puVar1 = *(undefined4 **)(*(int *)(param_1 + 0x80) + uVar3 * 4);

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

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

      }

      uVar3 = uVar3 + 1;

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

  }

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

  if ((*(uint *)(param_1 + 0x84) & 0x80000000) == 0x80000000) {

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

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

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

    return;

  }

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

    iVar2 = (*(uint *)(param_1 + 0x84) & 0x7fffffff) - 1;

    while (-1 < iVar2) {

      iVar2 = iVar2 + -1;

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

    }

  }

  return;

}





// --- FUN_00465cd0 at 0x00465CD0 (size: 286) ---


void __fastcall FUN_00465cd0(int param_1)



{

  int *piVar1;

  char cVar2;

  undefined4 uVar3;

  uint uVar4;

  

  FUN_00465fb0(3);

  if (*(uint *)(param_1 + 0x88) <= *(uint *)(param_1 + 0x8c)) {

    return;

  }

  do {

    piVar1 = *(int **)(*(int *)(param_1 + 0x80) + *(int *)(param_1 + 0x8c) * 4);

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

      switch(piVar1[1]) {

      case 1:

        uVar3 = (**(code **)(*piVar1 + 0x50))();

        cVar2 = FUN_004657e0(uVar3);

        break;

      case 2:

        uVar3 = (**(code **)(*piVar1 + 0x20))();

        cVar2 = FUN_00465960(uVar3);

        break;

      case 3:

        uVar3 = (**(code **)(*piVar1 + 0x10))();

        cVar2 = FUN_00465810(uVar3);

        break;

      case 4:

        uVar3 = (**(code **)(*piVar1 + 0x58))();

        cVar2 = FUN_00465bb0(uVar3);

        break;

      case 5:

        uVar3 = (**(code **)(*piVar1 + 0x18))();

        cVar2 = FUN_004659a0(uVar3);

        break;

      case 6:

        uVar3 = (**(code **)(*piVar1 + 0x30))();

        cVar2 = FUN_004656e0(uVar3);

        break;

      case 7:

        uVar3 = (**(code **)(*piVar1 + 0x38))();

        cVar2 = FUN_00465730(uVar3);

        break;

      case 8:

        uVar3 = (**(code **)(*piVar1 + 0x28))();

        cVar2 = FUN_00465650(uVar3);

        break;

      case 9:

        uVar3 = (**(code **)(*piVar1 + 0x40))();

        cVar2 = FUN_004659e0(uVar3);

        break;

      case 10:

        uVar3 = (**(code **)(*piVar1 + 0x48))();

        cVar2 = FUN_00465790(uVar3);

        break;

      case 0xb:

        uVar3 = (**(code **)(*piVar1 + 0x60))();

        cVar2 = FUN_00465a60(uVar3);

        break;

      default:

        goto switchD_00465d14_default;

      }

      if (cVar2 == '\0') {

        FUN_00465f90(3);

        return;

      }

    }

switchD_00465d14_default:

    uVar4 = *(int *)(param_1 + 0x8c) + 1;

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

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

      return;

    }

  } while( true );

}





// --- FUN_00465e30 at 0x00465E30 (size: 55) ---


void __fastcall FUN_00465e30(undefined4 *param_1)



{

  *param_1 = &PTR_FUN_0079d0fc;

  FUN_00465c20();

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

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

  }

  FUN_004663b0();

  return;

}





// --- FUN_00465e70 at 0x00465E70 (size: 76) ---


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



{

  *param_1 = &PTR_FUN_0079d0fc;

  FUN_00465c20();

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

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

  }

  FUN_004663b0();

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

    operator_delete(param_1);

  }

  return param_1;

}





// --- FUN_00465ec0 at 0x00465EC0 (size: 143) ---


void __thiscall FUN_00465ec0(int param_1,int *param_2)



{

  char cVar1;

  int iVar2;

  uint uVar3;

  undefined4 uVar4;

  uint uVar5;

  

  FUN_00465c20();

  uVar5 = 0;

  if (param_2[2] != 0) {

    do {

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

      if ((iVar2 != 0) && (iVar2 = FUN_0069e380(iVar2), iVar2 != 0)) {

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

        if (uVar3 <= *(uint *)(param_1 + 0x88)) {

          uVar4 = FUN_00453850(uVar3 + 1);

          cVar1 = FUN_004180a0(uVar4);

          if (cVar1 == '\0') goto LAB_00465f2b;

        }

        *(int *)(*(int *)(param_1 + 0x80) + *(int *)(param_1 + 0x88) * 4) = iVar2;

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

      }

LAB_00465f2b:

      uVar5 = uVar5 + 1;

    } while (uVar5 < (uint)param_2[2]);

  }

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

  FUN_00465cd0();

  return;

}





// --- FUN_00465f50 at 0x00465F50 (size: 30) ---


void __thiscall FUN_00465f50(undefined4 param_1,undefined4 param_2,undefined4 param_3)



{

  if (DAT_0083e03c != 0) {

    FUN_0045f380(param_1,param_2,param_3);

  }

  return;

}





// --- FUN_00465f70 at 0x00465F70 (size: 30) ---


void __thiscall FUN_00465f70(undefined4 param_1,undefined4 param_2,undefined4 param_3)



{

  if (DAT_0083e03c != 0) {

    FUN_0045c1b0(param_1,param_2,param_3);

  }

  return;

}





// --- FUN_00465f90 at 0x00465F90 (size: 25) ---


void __thiscall FUN_00465f90(undefined4 param_1,undefined4 param_2)



{

  if (DAT_0083e03c != 0) {

    FUN_0045e760(param_1,param_2);

  }

  return;

}





// --- FUN_00465fb0 at 0x00465FB0 (size: 25) ---


void __thiscall FUN_00465fb0(undefined4 param_1,undefined4 param_2)



{

  if (DAT_0083e03c != 0) {

    FUN_0045c1f0(param_1,param_2);

  }

  return;

}





// --- FUN_00465fd0 at 0x00465FD0 (size: 64) ---


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



{

  *param_1 = &PTR_FUN_0079d114;

  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_00466010 at 0x00466010 (size: 73) ---


void __fastcall FUN_00466010(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_004660f0(*puVar2);

  return;

}





// --- FUN_00466060 at 0x00466060 (size: 143) ---


undefined4 * __thiscall FUN_00466060(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_0079d114;

  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_004660f0 at 0x004660F0 (size: 310) ---


undefined4 __thiscall FUN_004660f0(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_004660f0(*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_0046613f;

      }

      piVar5 = *(int **)(param_1 + 100) + 1;

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

    }

    puVar11 = (uint *)0x0;

    puVar9 = (uint *)0x0;

LAB_0046613f:

    puVar7 = (uint *)*puVar11;

    if (puVar7 == puVar9) {

LAB_00466152:

      *puVar11 = puVar7[1];

    }

    else {

      do {

        puVar6 = puVar7;

        puVar7 = (uint *)puVar6[1];

      } while (puVar7 != puVar9);

      if (puVar6 == (uint *)0x0) goto LAB_00466152;

      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_00466230 at 0x00466230 (size: 120) ---


uint __thiscall FUN_00466230(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_0046625b:

      if ((int)(*(uint *)(param_1 + 0x68) * 2) < *(int *)(param_1 + 0x6c) + 1) {

        FUN_00466010();

      }

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

    }

    puVar1 = (uint *)puVar1[1];

  } while( true );

}





// --- FUN_004662b0 at 0x004662B0 (size: 111) ---


undefined4 __thiscall FUN_004662b0(int param_1,uint *param_2)



{

  uint *puVar1;

  

  puVar1 = *(uint **)(*(int *)(param_1 + 100) + (*param_2 % *(uint *)(param_1 + 0x6c)) * 4);

  do {

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

LAB_004662db:

      puVar1 = (uint *)FUN_005df0f5(8);

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

        *puVar1 = *param_2;

        puVar1[1] = 0;

        FUN_00466230(puVar1);

        return 1;

      }

      FUN_00466230(0);

      return 1;

    }

    if (*puVar1 == *param_2) {

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

        return 0;

      }

      goto LAB_004662db;

    }

    puVar1 = (uint *)puVar1[1];

  } while( true );

}





// --- FUN_00466320 at 0x00466320 (size: 82) ---


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



{

  *param_1 = &PTR_FUN_0079d118;

  FUN_005870f0();

  param_1[1] = &PTR_FUN_0079d114;

  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_00466380 at 0x00466380 (size: 37) ---


undefined4 * __fastcall FUN_00466380(undefined4 *param_1)



{

  *param_1 = &PTR_FUN_0079d11c;

  param_1[1] = &PTR_FUN_0079d118;

  FUN_00466060(0x17);

  param_1[0x1e] = 0;

  return param_1;

}





// --- FUN_004663b0 at 0x004663B0 (size: 191) ---


void __fastcall FUN_004663b0(undefined4 *param_1)



{

  int iVar1;

  int iVar2;

  int *piVar3;

  int iVar4;

  undefined1 local_c [12];

  

  *param_1 = &PTR_FUN_0079d11c;

  if (DAT_0083e03c != 0) {

    FUN_0045c210(param_1);

  }

  piVar3 = (int *)FUN_0052dcf0(local_c);

  iVar4 = piVar3[2];

  iVar1 = *piVar3;

  piVar3 = (int *)piVar3[1];

  do {

    if (iVar4 == 0) {

      param_1[1] = &PTR_FUN_0079d118;

      FUN_005870f0();

      param_1[2] = &PTR_FUN_0079d114;

      if ((undefined4 *)param_1[0x1a] != param_1 + 3) {

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

      }

      param_1[0x1a] = 0;

      param_1[0x1b] = 0;

      param_1[0x1c] = 0;

      param_1[0x1d] = 0;

      *param_1 = &PTR_FUN_00795824;

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

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

      }

      return;

    }

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

    iVar4 = iVar2;

    if (iVar2 == 0) {

      do {

        piVar3 = piVar3 + 1;

        iVar4 = iVar2;

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

        iVar4 = *piVar3;

      } while (iVar4 == 0);

    }

    FUN_00464b00(param_1);

  } while( true );

}





// --- FUN_00466470 at 0x00466470 (size: 16) ---


void FUN_00466470(void)



{

  FUN_004662b0(&stack0x00000004);

  return;

}





// --- FUN_00466480 at 0x00466480 (size: 27) ---


void FUN_00466480(void)



{

  void *pvVar1;

  

  pvVar1 = (void *)FUN_004171e0(&stack0x00000004);

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

    operator_delete(pvVar1);

  }

  return;

}





// --- FUN_004664a0 at 0x004664A0 (size: 30) ---


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



{

  FUN_004663b0();

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

    operator_delete(param_1);

  }

  return param_1;

}





// --- FUN_004664c0 at 0x004664C0 (size: 30) ---


undefined4 __fastcall FUN_004664c0(int *param_1)



{

  if ((param_1[2] - *param_1 != -1 && -1 < (param_1[2] - *param_1) + 1) &&

     (param_1[3] - param_1[1] != -1 && -1 < (param_1[3] - param_1[1]) + 1)) {

    return 1;

  }

  return 0;

}





// --- FUN_00466540 at 0x00466540 (size: 34) ---


undefined1 __fastcall FUN_00466540(int param_1)



{

  FUN_00466910(0);

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

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

  return 1;

}





// --- FUN_00466570 at 0x00466570 (size: 51) ---


void __thiscall FUN_00466570(int *param_1,undefined4 param_2)



{

  int iVar1;

  

  iVar1 = (**(code **)(*param_1 + 0x13c))(1,param_2,1);

  FUN_00474480(param_1[0x17e],param_1[0x17f] + iVar1,0);

  return;

}





// --- FUN_004665d0 at 0x004665D0 (size: 167) ---


void __fastcall FUN_004665d0(int *param_1)



{

  int iVar1;

  uint uVar2;

  undefined4 uVar3;

  int iVar4;

  

  param_1[2] = 0;

  if ((param_1[1] & 0x80000000U) != 0x80000000) {

    if ((*param_1 != 0) && (uVar2 = param_1[1] & 0x7fffffff, -1 < (int)(uVar2 - 1))) {

      do {

        uVar3 = FUN_00474bc0();

        FUN_00474c30(uVar3);

        FUN_00474be0();

        uVar2 = uVar2 - 1;

      } while (uVar2 != 0);

    }

    return;

  }

  iVar1 = *param_1;

  if (iVar1 != 0) {

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

    if (-1 < iVar4 + -1) {

      do {

        FUN_00474be0();

        iVar4 = iVar4 + -1;

      } while (iVar4 != 0);

    }

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

  }

  *param_1 = 0;

  param_1[1] = 0;

  return;

}





// --- FUN_00466680 at 0x00466680 (size: 171) ---


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



{

  int iVar1;

  int iVar2;

  int *piVar3;

  int *piVar4;

  int *piVar5;

  int iVar6;

  int iVar7;

  int local_4;

  

  piVar4 = param_3;

  piVar3 = param_2;

  param_2 = (int *)*param_2;

  local_4 = *param_1;

  piVar5 = (int *)&param_2;

  if ((int)param_2 <= *param_1) {

    piVar5 = &local_4;

  }

  iVar1 = *piVar5;

  *param_3 = iVar1;

  param_2 = (int *)piVar3[1];

  param_3 = (int *)param_1[1];

  piVar5 = (int *)&param_2;

  if (piVar3[1] <= param_1[1]) {

    piVar5 = (int *)&param_3;

  }

  iVar2 = *piVar5;

  piVar4[1] = iVar2;

  param_2 = (int *)piVar3[2];

  param_3 = (int *)param_1[2];

  piVar5 = (int *)&param_2;

  if (param_1[2] <= piVar3[2]) {

    piVar5 = (int *)&param_3;

  }

  iVar6 = *piVar5;

  piVar4[2] = iVar6;

  param_3 = (int *)param_1[3];

  param_2 = (int *)piVar3[3];

  piVar5 = (int *)&param_2;

  if (param_1[3] <= piVar3[3]) {

    piVar5 = (int *)&param_3;

  }

  iVar7 = *piVar5;

  iVar6 = iVar6 - iVar1;

  piVar4[3] = iVar7;

  if ((iVar6 != -1 && -1 < iVar6 + 1) && (iVar7 = iVar7 - iVar2, iVar7 != -1 && -1 < iVar7 + 1)) {

    return 1;

  }

  return 0;

}





// --- FUN_00466730 at 0x00466730 (size: 38) ---


void __thiscall FUN_00466730(int param_1,char param_2)



{

  if (param_2 != '\0') {

    *(uint *)(param_1 + 0x694) = *(uint *)(param_1 + 0x694) | 8;

    return;

  }

  *(uint *)(param_1 + 0x694) = *(uint *)(param_1 + 0x694) & 0xfffffff7;

  return;

}





// --- FUN_00466760 at 0x00466760 (size: 38) ---


void __thiscall FUN_00466760(int param_1,char param_2)



{

  if (param_2 != '\0') {

    *(uint *)(param_1 + 0x694) = *(uint *)(param_1 + 0x694) | 0x10;

    return;

  }

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

  return;

}





// --- FUN_00466790 at 0x00466790 (size: 62) ---


uint __fastcall FUN_00466790(int param_1)



{

  uint in_EAX;

  undefined4 uVar1;

  uint uVar2;

  undefined1 local_10 [16];

  

  if ((*(byte *)(param_1 + 0x694) & 8) != 0) {

    return in_EAX & 0xffffff00;

  }

  uVar1 = FUN_006a0340(local_10);

  uVar2 = FUN_004154a0(*(undefined4 *)(param_1 + 0x6b4),param_1 + 0x6a4,uVar1);

  return uVar2;

}





// --- FUN_004667d0 at 0x004667D0 (size: 86) ---


void __fastcall FUN_004667d0(int param_1)



{

  int *piVar1;

  uint uVar2;

  

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

    uVar2 = 0;

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

      do {

        piVar1 = *(int **)(*(int *)(param_1 + 0x700) + uVar2 * 4);

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

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

        }

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

        uVar2 = uVar2 + 1;

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

    }

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

    FUN_00465fb0(3);

  }

  return;

}





// --- FUN_00466830 at 0x00466830 (size: 103) ---


undefined4 * FUN_00466830(undefined4 *param_1)



{

  LONG LVar1;

  undefined4 *puVar2;

  undefined *local_4;

  

  local_4 = PTR_DAT_00818340;

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

  FUN_00474130(0,&local_4);

  *param_1 = local_4;

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

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

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

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

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

  }

  return param_1;

}





// --- FUN_004668a0 at 0x004668A0 (size: 103) ---


undefined4 * FUN_004668a0(undefined4 *param_1)



{

  LONG LVar1;

  undefined4 *puVar2;

  undefined *local_4;

  

  local_4 = PTR_DAT_00818340;

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

  FUN_00474130(1,&local_4);

  *param_1 = local_4;

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

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

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

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

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

  }

  return param_1;

}





// --- FUN_00466910 at 0x00466910 (size: 110) ---


void __thiscall FUN_00466910(int param_1,char param_2)



{

  uint uVar1;

  

  if ((bool)param_2 != (((byte)*(undefined4 *)(param_1 + 0x694) & 0x80) == 0x80)) {

    if (param_2 != '\0') {

      *(uint *)(param_1 + 0x694) = *(uint *)(param_1 + 0x694) | 0x80;

      return;

    }

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

    *(uint *)(param_1 + 0x694) = uVar1 & 0xffffff7f;

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

      *(uint *)(param_1 + 0x694) = uVar1 & 0xffffff3f;

    }

    FUN_00466910(0);

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

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

  }

  return;

}





// --- FUN_00466980 at 0x00466980 (size: 70) ---


void __thiscall FUN_00466980(int param_1,char param_2)



{

  if ((bool)param_2 != ((*(uint *)(param_1 + 0x694) & 0x100) == 0x100)) {

    if (param_2 == '\0') {

      *(uint *)(param_1 + 0x694) = *(uint *)(param_1 + 0x694) & 0xfffffeff;

      return;

    }

    *(uint *)(param_1 + 0x694) = *(uint *)(param_1 + 0x694) | 0x100;

    FUN_006a0430();

  }

  return;

}





// --- FUN_004669d0 at 0x004669D0 (size: 183) ---


void __fastcall FUN_004669d0(int *param_1)



{

  int iVar1;

  int iVar2;

  int *piVar3;

  int iStack_18;

  int iStack_14;

  int local_10;

  int iStack_c;

  int iStack_8;

  

  (**(code **)(*param_1 + 0x34))(&local_10);

  iStack_18 = (iStack_c - iStack_14) + 1;

  iVar2 = (iStack_8 - local_10) + 1;

  piVar3 = (int *)&stack0xffffffe4;

  if (param_1[0x1b3] <= iVar2) {

    piVar3 = param_1 + 0x1b3;

  }

  iVar1 = *piVar3;

  param_1[0x1b3] = iVar1;

  piVar3 = (int *)&stack0xffffffe4;

  if (param_1[0x1b4] <= iVar2 - iVar1) {

    piVar3 = param_1 + 0x1b4;

  }

  param_1[0x1b4] = *piVar3;

  piVar3 = &iStack_18;

  if (param_1[0x1b5] <= iStack_18) {

    piVar3 = param_1 + 0x1b5;

  }

  iStack_18 = iStack_18 - *piVar3;

  param_1[0x1b5] = *piVar3;

  if (iStack_18 < param_1[0x1b6]) {

    param_1[0x1b6] = iStack_18;

    return;

  }

  param_1[0x1b6] = param_1[0x1b6];

  return;

}





// --- FUN_00466a90 at 0x00466A90 (size: 338) ---


void __thiscall FUN_00466a90(int *param_1,uint param_2,int *param_3)



{

  char cVar1;

  int iVar2;

  int *unaff_EBX;

  undefined4 *unaff_EDI;

  uint unaff_retaddr;

  undefined4 local_10;

  int *local_c;

  int iStack_4;

  

  if (*param_3 != 0) {

    local_10 = 0;

    local_c = (int *)0x0;

    cVar1 = (**(code **)(*param_1 + 0xd0))(param_2,&local_10);

    if (cVar1 != '\0') {

      if ((unaff_EBX == (int *)0x0) ||

         (cVar1 = (**(code **)(*unaff_EBX + 0xf0))(&stack0x00000000), cVar1 == '\0')) {

LAB_00466bd0:

        FUN_004234d0();

        return;

      }

      if (param_2 < unaff_retaddr) {

        local_10 = 0;

        local_c = (int *)0x0;

        if ((((unaff_EBX == (int *)0x0) ||

             (cVar1 = (**(code **)(*unaff_EBX + 0xf4))(param_2,&local_10), cVar1 == '\0')) ||

            (local_c == (int *)0x0)) ||

           (cVar1 = (**(code **)(*local_c + 0xb0))(&iStack_4), cVar1 == '\0')) {

          FUN_004234d0();

          goto LAB_00466bd0;

        }

        if (((iStack_4 != DAT_0083e318) && (iStack_4 != *(int *)(*param_3 + 0x28))) &&

           (iVar2 = FUN_0044b680(iStack_4), iVar2 != 0)) {

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

            (**(code **)(*(int *)*param_3 + 0x14))();

            *param_3 = 0;

          }

          *param_3 = iVar2;

        }

        FUN_004234d0();

      }

    }

    if ((unaff_EDI != (undefined4 *)0x0) &&

       (iVar2 = unaff_EDI[1], unaff_EDI[1] = iVar2 + -1, iVar2 + -1 == 0)) {

      (**(code **)*unaff_EDI)(1);

    }

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

       (iVar2 = unaff_EBX[1], unaff_EBX[1] = iVar2 + -1, iVar2 + -1 == 0)) {

      (**(code **)*unaff_EBX)(1);

    }

  }

  return;

}





// --- FUN_00466bf0 at 0x00466BF0 (size: 299) ---


void __thiscall FUN_00466bf0(int *param_1,uint param_2)



{

  char cVar1;

  int *unaff_EBX;

  undefined4 *unaff_ESI;

  int iVar2;

  undefined4 unaff_retaddr;

  undefined4 local_10;

  int *local_c;

  uint uStack_4;

  

  local_10 = 0;

  local_c = (int *)0x0;

  cVar1 = (**(code **)(*param_1 + 0xd0))(param_2,&local_10);

  if (cVar1 != '\0') {

    if ((unaff_EBX == (int *)0x0) ||

       (cVar1 = (**(code **)(*unaff_EBX + 0xf0))(&uStack_4), cVar1 == '\0')) {

      if ((unaff_ESI != (undefined4 *)0x0) &&

         (iVar2 = unaff_ESI[1], unaff_ESI[1] = iVar2 + -1, iVar2 + -1 == 0)) {

        (**(code **)*unaff_ESI)(1);

      }

      goto joined_r0x00466cad;

    }

    if (param_2 < uStack_4) {

      local_10 = 0;

      local_c = (int *)0x0;

      if ((((unaff_EBX == (int *)0x0) ||

           (cVar1 = (**(code **)(*unaff_EBX + 0xf4))(param_2,&local_10), cVar1 == '\0')) ||

          (local_c == (int *)0x0)) ||

         (cVar1 = (**(code **)(*local_c + 0x98))(unaff_retaddr), cVar1 == '\0')) {

        FUN_004234d0();

        FUN_004234d0();

        return;

      }

      FUN_004234d0();

    }

  }

  if ((unaff_ESI != (undefined4 *)0x0) &&

     (iVar2 = unaff_ESI[1], unaff_ESI[1] = iVar2 + -1, iVar2 + -1 == 0)) {

    (**(code **)*unaff_ESI)(1);

  }

joined_r0x00466cad:

  if ((unaff_EBX != (int *)0x0) && (iVar2 = unaff_EBX[1] + -1, unaff_EBX[1] = iVar2, iVar2 == 0)) {

    (**(code **)*unaff_EBX)(1);

  }

  return;

}





// --- FUN_00466d20 at 0x00466D20 (size: 338) ---


void __thiscall FUN_00466d20(int *param_1,undefined4 param_2)



{

  char cVar1;

  int iVar2;

  undefined4 *local_10;

  int *local_c;

  undefined4 uStack_8;

  int *piStack_4;

  

  local_10 = (undefined4 *)0x0;

  local_c = (int *)0x0;

  cVar1 = FUN_0042a2d0(0x19);

  if (cVar1 == '\0') {

    if ((local_10 != (undefined4 *)0x0) &&

       (iVar2 = local_10[1], local_10[1] = iVar2 + -1, iVar2 + -1 == 0)) {

      (**(code **)*local_10)(1);

    }

  }

  else {

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

      FUN_00429b10();

      cVar1 = (**(code **)(*local_c + 0x9c))(param_2);

      if (cVar1 != '\0') {

        uStack_8 = 0;

        piStack_4 = (int *)0x0;

        cVar1 = FUN_0042a2d0(0x1b);

        if ((cVar1 != '\0') && (piStack_4 != (int *)0x0)) {

          FUN_00429b10();

          cVar1 = (**(code **)(*piStack_4 + 0xf8))(0,&local_10);

          if ((cVar1 != '\0') && (cVar1 = (**(code **)(*param_1 + 0xd4))(&uStack_8), cVar1 != '\0'))

          {

            FUN_004234d0();

            FUN_004234d0();

            return;

          }

        }

        FUN_004234d0();

        FUN_004234d0();

        return;

      }

    }

    if ((local_10 != (undefined4 *)0x0) &&

       (iVar2 = local_10[1], local_10[1] = iVar2 + -1, iVar2 + -1 == 0)) {

      (**(code **)*local_10)(1);

    }

  }

  local_10 = (undefined4 *)0x0;

  if ((local_c != (int *)0x0) && (iVar2 = local_c[1] + -1, local_c[1] = iVar2, iVar2 == 0)) {

    (**(code **)*local_c)(1);

  }

  return;

}





// --- FUN_00466e80 at 0x00466E80 (size: 338) ---


void __thiscall FUN_00466e80(int *param_1,undefined4 param_2)



{

  char cVar1;

  int iVar2;

  undefined4 *local_10;

  int *local_c;

  undefined4 uStack_8;

  int *piStack_4;

  

  local_10 = (undefined4 *)0x0;

  local_c = (int *)0x0;

  cVar1 = FUN_0042a2d0(0x18);

  if (cVar1 == '\0') {

    if ((local_10 != (undefined4 *)0x0) &&

       (iVar2 = local_10[1], local_10[1] = iVar2 + -1, iVar2 + -1 == 0)) {

      (**(code **)*local_10)(1);

    }

  }

  else {

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

      FUN_00429b10();

      cVar1 = (**(code **)(*local_c + 0xb4))(param_2);

      if (cVar1 != '\0') {

        uStack_8 = 0;

        piStack_4 = (int *)0x0;

        cVar1 = FUN_0042a2d0(0x1a);

        if ((cVar1 != '\0') && (piStack_4 != (int *)0x0)) {

          FUN_00429b10();

          cVar1 = (**(code **)(*piStack_4 + 0xf8))(0,&local_10);

          if ((cVar1 != '\0') && (cVar1 = (**(code **)(*param_1 + 0xd4))(&uStack_8), cVar1 != '\0'))

          {

            FUN_004234d0();

            FUN_004234d0();

            return;

          }

        }

        FUN_004234d0();

        FUN_004234d0();

        return;

      }

    }

    if ((local_10 != (undefined4 *)0x0) &&

       (iVar2 = local_10[1], local_10[1] = iVar2 + -1, iVar2 + -1 == 0)) {

      (**(code **)*local_10)(1);

    }

  }

  local_10 = (undefined4 *)0x0;

  if ((local_c != (int *)0x0) && (iVar2 = local_c[1] + -1, local_c[1] = iVar2, iVar2 == 0)) {

    (**(code **)*local_c)(1);

  }

  return;

}





// --- FUN_00466fe0 at 0x00466FE0 (size: 27) ---


void FUN_00466fe0(undefined4 param_1)



{

  DAT_00819a70 = 0;

  FUN_00466e80(param_1);

  DAT_00819a70 = 1;

  return;

}





// --- FUN_00467000 at 0x00467000 (size: 53) ---


void __thiscall FUN_00467000(int param_1,undefined4 param_2)



{

  FUN_00472ff0(param_2);

  if ((*(uint *)(param_1 + 0x694) & 0x100) == 0) {

    *(uint *)(param_1 + 0x694) = *(uint *)(param_1 + 0x694) | 0x100;

    FUN_006a0430();

  }

  return;

}





// --- FUN_00467040 at 0x00467040 (size: 165) ---


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



{

  undefined4 uVar1;

  char cVar2;

  int local_8;

  int local_4;

  

  uVar1 = param_3;

  local_4 = 0;

  local_8 = 0;

  cVar2 = FUN_00472ab0(param_3,&local_4,&local_8);

  if (cVar2 != '\0') {

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

      *param_4 = local_8;

      return;

    }

    param_2 = 0;

    cVar2 = FUN_00472c00(uVar1,&param_2,&local_8);

    if (cVar2 != '\0') {

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

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

        return;

      }

      *param_4 = local_8 + -1;

    }

  }

  return;

}





// --- FUN_004670f0 at 0x004670F0 (size: 92) ---


undefined4 __thiscall FUN_004670f0(int param_1,uint param_2)



{

  uint *puVar1;

  uint uVar2;

  uint *puVar3;

  

  if (*(char *)(param_1 + 0x694) < '\0') {

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

    *puVar1 = param_2;

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

    puVar3 = &param_2;

    if (*puVar1 <= *(uint *)(param_1 + 0x61c)) {

      puVar3 = puVar1;

    }

    uVar2 = *puVar3;

    *puVar1 = uVar2;

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

    if ((*(uint *)(param_1 + 0x694) & 0x100) == 0) {

      *(uint *)(param_1 + 0x694) = *(uint *)(param_1 + 0x694) | 0x100;

      FUN_006a0430();

    }

    return 1;

  }

  return 0;

}





// --- FUN_00467150 at 0x00467150 (size: 84) ---


undefined4 __thiscall FUN_00467150(int param_1,uint param_2)



{

  uint *puVar1;

  uint *puVar2;

  

  if (*(char *)(param_1 + 0x694) < '\0') {

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

    *puVar1 = param_2;

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

    puVar2 = &param_2;

    if (*puVar1 <= *(uint *)(param_1 + 0x61c)) {

      puVar2 = puVar1;

    }

    *puVar1 = *puVar2;

    if ((*(uint *)(param_1 + 0x694) & 0x100) == 0) {

      *(uint *)(param_1 + 0x694) = *(uint *)(param_1 + 0x694) | 0x100;

      FUN_006a0430();

    }

    return 1;

  }

  return 0;

}





// --- FUN_004671b0 at 0x004671B0 (size: 92) ---


void __thiscall FUN_004671b0(int param_1,uint *param_2,uint *param_3)



{

  uint *puVar1;

  uint *puVar2;

  uint *puVar3;

  

  *param_2 = 0;

  *param_3 = 0;

  if (((byte)*(undefined4 *)(param_1 + 0x694) & 0x80) == 0x80) {

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

    puVar2 = (uint *)(param_1 + 0x644);

    puVar3 = puVar1;

    if (*(uint *)(param_1 + 0x644) <= *puVar1) {

      puVar3 = puVar2;

    }

    *param_2 = *puVar3;

    if (*puVar2 < *puVar1) {

      puVar2 = puVar1;

    }

    *param_3 = *puVar2;

  }

  return;

}





// --- FUN_00467210 at 0x00467210 (size: 632) ---


void __thiscall FUN_00467210(int param_1,int *param_2,int *param_3)



{

  int iVar1;

  undefined4 uVar2;

  LONG LVar3;

  int *piVar4;

  uint uVar5;

  uint uVar6;

  undefined4 *puVar7;

  int iVar8;

  undefined4 uVar9;

  char local_a1;

  int local_a0;

  int iStack_9c;

  uint local_98;

  int iStack_94;

  undefined1 local_90 [144];

  

  FUN_00460cc0(0xd0,&local_a1);

  if ((*(byte *)(param_1 + 0x694) & 2) == 0) {

    iVar1 = FUN_0069fe70();

  }

  else {

    iVar1 = FUN_0069fe60();

  }

  if ((*(byte *)(param_1 + 0x694) & 2) == 0) {

    iVar8 = *param_3;

  }

  else {

    iVar8 = *param_2;

  }

  if (iVar1 < iVar8) {

    uVar6 = 0;

    if (local_a1 != '\0') {

      FUN_0042dc80();

      uVar9 = 1;

      uVar2 = FUN_00466830(&local_a0);

      FUN_0042cbe0(uVar2,uVar9);

      puVar7 = (undefined4 *)(local_a0 + -0x14);

      LVar3 = InterlockedDecrement((LONG *)(local_a0 + -0x10));

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

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

      }

      FUN_004618a0(local_90);

      *(uint *)(param_1 + 0xa4) = *(uint *)(param_1 + 0xa4) | 0x20;

      FUN_0042e590();

    }

    local_98 = 0;

    if ((*(byte *)(param_1 + 0x694) & 2) == 0) {

      FUN_00472bb0(iVar1,&local_98);

    }

    iVar1 = FUN_0069fe60();

    FUN_00473690(local_98,((iVar1 - *(int *)(param_1 + 0x6d8)) - *(int *)(param_1 + 0x6d4)) -

                          *(int *)(param_1 + 0x684),0,(undefined4 *)(param_1 + 0x680));

    if ((*(byte *)(param_1 + 0x694) & 2) != 0) {

      FUN_00472f00(*(undefined4 *)(param_1 + 0x680),&local_a0);

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

      local_a0 = local_a0 + *(int *)(param_1 + 0x684);

      *(int *)(param_1 + 0x690) = local_a0;

      *param_2 = *(int *)(param_1 + 0x6d8) + *(int *)(param_1 + 0x6d4) + local_a0;

      return;

    }

    iStack_94 = 0;

    iVar1 = 0;

    local_a0 = 0;

    uVar5 = local_98;

    do {

      iVar8 = *(int *)(param_1 + 0x620) + local_a0;

      if (uVar6 == uVar5) {

        FUN_00472f00(*(undefined4 *)(param_1 + 0x680),&iStack_9c);

        iStack_9c = iStack_9c + *(int *)(param_1 + 0x684);

        *(int *)(param_1 + 0x690) = iStack_9c;

        uVar5 = local_98;

      }

      else {

        iStack_9c = *(int *)(iVar8 + 8);

      }

      piVar4 = &iStack_9c;

      if (iStack_9c <= iStack_94) {

        piVar4 = &iStack_94;

      }

      iStack_94 = *piVar4;

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

      uVar6 = uVar6 + 1;

      local_a0 = local_a0 + 0x10;

    } while (uVar6 <= uVar5);

    *(uint *)(param_1 + 0x68c) = uVar5;

    *param_2 = *(int *)(param_1 + 0x6d8) + *(int *)(param_1 + 0x6d4) + iStack_94;

    *param_3 = *(int *)(param_1 + 0x6d0) + *(int *)(param_1 + 0x6cc) + iVar1;

  }

  else {

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

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

    if (local_a1 != '\0') {

      *(uint *)(param_1 + 0xa4) = *(uint *)(param_1 + 0xa4) & 0xffffffdf;

      FUN_004626c0();

      return;

    }

  }

  return;

}





// --- FUN_00467490 at 0x00467490 (size: 43) ---


undefined4 __thiscall FUN_00467490(int param_1,undefined4 param_2)



{

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

  if ((*(uint *)(param_1 + 0x694) & 0x100) == 0) {

    *(uint *)(param_1 + 0x694) = *(uint *)(param_1 + 0x694) | 0x100;

    FUN_006a0430();

  }

  return 1;

}





// --- FUN_004674c0 at 0x004674C0 (size: 43) ---


undefined4 __thiscall FUN_004674c0(int param_1,undefined4 param_2)



{

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

  if ((*(uint *)(param_1 + 0x694) & 0x100) == 0) {

    *(uint *)(param_1 + 0x694) = *(uint *)(param_1 + 0x694) | 0x100;

    FUN_006a0430();

  }

  return 1;

}





// --- FUN_004674f0 at 0x004674F0 (size: 232) ---


int __thiscall FUN_004674f0(int *param_1,int param_2,char param_3)



{

  char cVar1;

  int *piVar2;

  uint uVar3;

  int iVar4;

  int *piVar5;

  int iVar6;

  uint unaff_retaddr;

  undefined1 local_20 [16];

  undefined1 local_10 [16];

  

  cVar1 = param_3;

  iVar6 = 0;

  if (param_3 == '\0') {

    iVar4 = (**(code **)(*param_1 + 0x34))(local_10);

    piVar5 = &param_2;

    if ((*(int *)(iVar4 + 0xc) - *(int *)(iVar4 + 4)) + 1 <= param_1[0x181]) {

      piVar5 = (int *)&stack0xffffffd8;

    }

    uVar3 = (*piVar5 - param_1[0x1b4]) - param_1[0x1b3];

    iVar4 = param_1[0x1a7];

  }

  else {

    piVar2 = (int *)(**(code **)(*param_1 + 0x34))(local_20);

    piVar5 = &param_2;

    if ((piVar2[2] - *piVar2) + 1 <= param_1[0x180]) {

      piVar5 = (int *)&stack0xffffffd8;

    }

    uVar3 = (*piVar5 - param_1[0x1b6]) - param_1[0x1b5];

    iVar4 = param_1[0x1a6];

  }

  if (iVar4 == 1) {

    uVar3 = uVar3 >> 1;

    unaff_retaddr = unaff_retaddr >> 1;

  }

  else if ((iVar4 != 3) && (iVar4 != 5)) goto LAB_004675b0;

  iVar6 = uVar3 - unaff_retaddr;

LAB_004675b0:

  if (cVar1 == '\0') {

    return param_1[0x1b3] + iVar6;

  }

  return param_1[0x1b5] + iVar6;

}





// --- FUN_004675e0 at 0x004675E0 (size: 121) ---


byte __fastcall FUN_004675e0(int param_1)



{

  byte bVar1;

  byte bVar2;

  byte bVar3;

  int unaff_retaddr;

  

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

    return 0;

  }

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

  bVar1 = FUN_00474210(unaff_retaddr);

  if ((*(byte *)(param_1 + 0x694) & 1) != 0) {

    bVar2 = (**(code **)(*DAT_00837ff4 + 0x34))(1,param_1,unaff_retaddr + -10);

    bVar3 = (**(code **)(*DAT_00837ff4 + 0x34))(7,param_1,unaff_retaddr);

    bVar1 = bVar1 | bVar2 | bVar3;

  }

  if ((*(byte *)(param_1 + 0x694) & 5) != 0) {

    bVar2 = (**(code **)(*DAT_00837ff4 + 0x34))(8,param_1,unaff_retaddr);

    bVar1 = bVar1 | bVar2;

  }

  return bVar1;

}





// --- FUN_00467660 at 0x00467660 (size: 97) ---


byte __fastcall FUN_00467660(int param_1)



{

  byte bVar1;

  byte bVar2;

  byte bVar3;

  

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

    return 0;

  }

  bVar1 = FUN_00474250();

  if ((*(byte *)(param_1 + 0x694) & 1) != 0) {

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

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

    bVar1 = bVar1 | bVar2 | bVar3;

  }

  if ((*(byte *)(param_1 + 0x694) & 5) != 0) {

    bVar2 = (**(code **)(*DAT_00837ff4 + 0x38))(8,param_1);

    bVar1 = bVar1 | bVar2;

  }

  return bVar1;

}





// --- FUN_00467710 at 0x00467710 (size: 103) ---


void __thiscall FUN_00467710(int param_1,char param_2)



{

  uint uVar1;

  

  if ((param_2 != '\0') && ((*(byte *)(param_1 + 0x694) & 5) != 0)) {

    param_2 = '\0';

  }

  if ((bool)param_2 != ((*(uint *)(param_1 + 0x694) & 0x800) == 0x800)) {

    if (param_2 == '\0') {

      uVar1 = *(uint *)(param_1 + 0x694) & 0xfffff7ff;

    }

    else {

      uVar1 = *(uint *)(param_1 + 0x694) | 0x800;

    }

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

    if ((*(uint *)(param_1 + 0x694) & 0x100) == 0) {

      *(uint *)(param_1 + 0x694) = *(uint *)(param_1 + 0x694) | 0x100;

      FUN_006a0430();

    }

  }

  return;

}





// --- FUN_00467780 at 0x00467780 (size: 42) ---


void __thiscall FUN_00467780(int param_1,char param_2)



{

  if (param_2 != '\0') {

    *(uint *)(param_1 + 0x694) = *(uint *)(param_1 + 0x694) | 0x1000;

    return;

  }

  *(uint *)(param_1 + 0x694) = *(uint *)(param_1 + 0x694) & 0xffffefff;

  return;

}





// --- FUN_004677b0 at 0x004677B0 (size: 42) ---


void __thiscall FUN_004677b0(int param_1,char param_2)



{

  if (param_2 != '\0') {

    *(uint *)(param_1 + 0x694) = *(uint *)(param_1 + 0x694) | 0x2000;

    return;

  }

  *(uint *)(param_1 + 0x694) = *(uint *)(param_1 + 0x694) & 0xffffdfff;

  return;

}





// --- FUN_004677e0 at 0x004677E0 (size: 161) ---


void __fastcall FUN_004677e0(int *param_1)



{

  char cVar1;

  int local_c;

  int local_8;

  int local_4;

  

  cVar1 = FUN_00460b30(0x3d,&local_c);

  if (cVar1 == '\0') {

    local_c = FUN_0054fd20();

  }

  cVar1 = FUN_00473bc0((local_c - param_1[0x1b6]) - param_1[0x1b5],

                       CONCAT31((int3)((uint)&local_8 >> 8),((byte)param_1[0x1a5] & 2) == 2),

                       &local_8,&local_4);

  if (cVar1 != '\0') {

    local_8 = local_8 + param_1[0x1b6] + param_1[0x1b5];

    local_4 = local_4 + param_1[0x1b4] + param_1[0x1b3];

    (**(code **)(*param_1 + 0x30))(local_8,local_4);

  }

  return;

}





// --- FUN_00467890 at 0x00467890 (size: 74) ---


void __fastcall FUN_00467890(int *param_1)



{

  int iVar1;

  int iVar2;

  

  if (((param_1[1] & 0x80000000U) == 0x80000000) && (iVar1 = *param_1, iVar1 != 0)) {

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

    if (-1 < iVar2 + -1) {

      do {

        FUN_00474be0();

        iVar2 = iVar2 + -1;

      } while (iVar2 != 0);

    }

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

  }

  return;

}





// --- FUN_004678e0 at 0x004678E0 (size: 267) ---


undefined4 __thiscall FUN_004678e0(int *param_1,uint param_2)



{

  uint *puVar1;

  uint uVar2;

  uint *puVar3;

  int iVar4;

  

  uVar2 = param_2;

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

    if (param_2 <= (param_1[1] & 0x7fffffffU)) {

      return 1;

    }

    if (param_2 == 0) {

      FUN_004665d0();

      return 1;

    }

    puVar3 = (uint *)thunk_FUN_005df0f5(param_2 * 0x24 + 4);

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

      puVar1 = puVar3 + 1;

      *puVar3 = param_2;

      FUN_00401000(puVar1,0x24,param_2,FUN_00474bc0);

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

        if (*param_1 != 0) {

          param_2 = param_1[2];

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

            iVar4 = (param_2 + -1) * 0x24;

            do {

              FUN_00474c30(*param_1 + iVar4);

              iVar4 = iVar4 + -0x24;

              param_2 = param_2 + -1;

            } while (param_2 != 0);

          }

          if (((param_1[1] & 0x80000000U) == 0x80000000) && (iVar4 = *param_1, iVar4 != 0)) {

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

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

              do {

                FUN_00474be0();

                param_2 = param_2 + -1;

              } while (param_2 != 0);

            }

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

          }

        }

        *param_1 = (int)puVar1;

        param_1[1] = uVar2 | 0x80000000;

        return 1;

      }

    }

  }

  return 0;

}





// --- FUN_004679f0 at 0x004679F0 (size: 125) ---


void __fastcall FUN_004679f0(undefined4 *param_1)



{

  *param_1 = &PTR_FUN_0079d198;

  param_1[0x182] = &PTR_FUN_0079d180;

  FUN_004667d0();

  FUN_004733e0();

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

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

    param_1[0x1ad] = 0;

  }

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

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

  }

  FUN_004738a0();

  FUN_004738a0();

  FUN_00474850();

  return;

}





// --- FUN_00467a90 at 0x00467A90 (size: 77) ---


bool FUN_00467a90(int *param_1)



{

  char cVar1;

  char cVar2;

  

  cVar1 = FUN_00474430(param_1);

  FUN_00425ba0();

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

    return false;

  }

  cVar2 = FUN_00427240(0x13,param_1);

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

  return cVar2 != '\0' && cVar1 != '\0';

}





// --- FUN_00467ae0 at 0x00467AE0 (size: 125) ---


void __fastcall FUN_00467ae0(int param_1)



{

  uint uVar1;

  undefined4 uVar2;

  undefined4 extraout_EDX;

  

  FUN_004667d0();

  FUN_004733e0();

  uVar2 = 0;

  if (*(char *)(param_1 + 0x694) < '\0') {

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

    *(uint *)(param_1 + 0x694) = uVar1 & 0xffffff7f;

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

      *(uint *)(param_1 + 0x694) = uVar1 & 0xffffff3f;

    }

    FUN_00466910(0);

    *(undefined4 *)(param_1 + 0x644) = extraout_EDX;

    *(undefined4 *)(param_1 + 0x648) = extraout_EDX;

    uVar2 = extraout_EDX;

  }

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

  if ((*(uint *)(param_1 + 0x694) & 0x100) == 0) {

    *(uint *)(param_1 + 0x694) = *(uint *)(param_1 + 0x694) | 0x100;

    FUN_006a0430();

    return;

  }

  return;

}





// --- FUN_00467b60 at 0x00467B60 (size: 84) ---


void __fastcall FUN_00467b60(int param_1)



{

  uint uVar1;

  

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

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

    if (-1 < (char)uVar1) {

      *(uint *)(param_1 + 0x694) = uVar1 | 0x80;

    }

    FUN_004670f0(0);

    FUN_00467150(*(undefined4 *)(param_1 + 0x61c));

    if ((*(uint *)(param_1 + 0x694) & 0x100) == 0) {

      *(uint *)(param_1 + 0x694) = *(uint *)(param_1 + 0x694) | 0x100;

      FUN_006a0430();

      return;

    }

  }

  return;

}





// --- FUN_00467bc0 at 0x00467BC0 (size: 107) ---


void __fastcall FUN_00467bc0(int param_1)



{

  uint uVar1;

  int extraout_EDX;

  

  if (*(char *)(param_1 + 0x694) < '\0') {

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

    *(uint *)(param_1 + 0x694) = uVar1 & 0xffffff7f;

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

      *(uint *)(param_1 + 0x694) = uVar1 & 0xffffff3f;

    }

    FUN_00466910(0);

    *(undefined4 *)(extraout_EDX + 0x644) = 0;

    *(undefined4 *)(extraout_EDX + 0x648) = 0;

    param_1 = extraout_EDX;

  }

  if ((*(uint *)(param_1 + 0x694) & 0x100) == 0) {

    *(uint *)(param_1 + 0x694) = *(uint *)(param_1 + 0x694) | 0x100;

    FUN_006a0430();

    return;

  }

  return;

}





// --- FUN_00467c30 at 0x00467C30 (size: 138) ---


undefined4 * FUN_00467c30(undefined4 *param_1)



{

  char cVar1;

  LONG LVar2;

  undefined4 *puVar3;

  undefined *local_c;

  undefined4 local_8;

  undefined4 local_4;

  

  local_c = PTR_DAT_00818340;

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

  cVar1 = FUN_004671b0(&local_4,&local_8);

  if (cVar1 != '\0') {

    FUN_00473920(local_4,local_8,0,&local_c);

  }

  *param_1 = local_c;

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

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

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

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

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

  }

  return param_1;

}





// --- FUN_00467cc0 at 0x00467CC0 (size: 103) ---


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



{

  int iVar1;

  int iVar2;

  int iVar3;

  

  iVar1 = FUN_0069fe60();

  iVar2 = FUN_0069fe70();

  FUN_00474a80(param_2,param_3);

  iVar3 = FUN_0069fe60();

  if ((iVar1 == iVar3) && (iVar1 = FUN_0069fe70(), iVar2 == iVar1)) {

    return;

  }

  FUN_004669d0();

  if ((*(uint *)(param_1 + 0x694) & 0x100) == 0) {

    *(uint *)(param_1 + 0x694) = *(uint *)(param_1 + 0x694) | 0x100;

    FUN_006a0430();

  }

  return;

}





// --- FUN_00468360 at 0x00468360 (size: 154) ---


void __thiscall FUN_00468360(int *param_1,char param_2)



{

  uint uVar1;

  char cVar2;

  uint uVar3;

  

  if (param_2 != (char)('\x01' - (((byte)param_1[0x1a5] & 1) != 1))) {

    if (param_2 == '\0') {

      cVar2 = FUN_00460310();

      if ((cVar2 != '\0') && ((*(byte *)(param_1 + 0x1a5) & 4) == 0)) {

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

      }

    }

    else if ((param_1[0x1a5] & 0x800U) != 0) {

      uVar1 = param_1[0x1a5];

      uVar3 = uVar1 & 0xfffff7ff;

      param_1[0x1a5] = uVar3;

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

        param_1[0x1a5] = uVar3 | 0x100;

        FUN_006a0430();

      }

    }

    if (param_2 != '\0') {

      param_1[0x1a5] = param_1[0x1a5] | 1;

      return;

    }

    param_1[0x1a5] = param_1[0x1a5] & 0xfffffffe;

  }

  return;

}





// --- FUN_00468400 at 0x00468400 (size: 76) ---


void __thiscall FUN_00468400(int param_1,char param_2)



{

  uint uVar1;

  

  if ((bool)param_2 != (((byte)*(undefined4 *)(param_1 + 0x694) & 2) == 2)) {

    if (param_2 == '\0') {

      uVar1 = *(uint *)(param_1 + 0x694) & 0xfffffffd;

    }

    else {

      uVar1 = *(uint *)(param_1 + 0x694) | 2;

    }

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

    if ((*(uint *)(param_1 + 0x694) & 0x100) == 0) {

      *(uint *)(param_1 + 0x694) = *(uint *)(param_1 + 0x694) | 0x100;

      FUN_006a0430();

    }

  }

  return;

}





// --- FUN_00468450 at 0x00468450 (size: 204) ---


void __thiscall FUN_00468450(int *param_1,char param_2)



{

  char cVar1;

  uint uVar2;

  uint uVar3;

  int extraout_EDX;

  

  if ((bool)param_2 != (((byte)param_1[0x1a5] & 4) == 4)) {

    if (param_2 == '\0') {

      cVar1 = FUN_00460310();

      if ((cVar1 != '\0') && ((*(byte *)(param_1 + 0x1a5) & 1) == 0)) {

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

      }

    }

    else if ((param_1[0x1a5] & 0x800U) != 0) {

      uVar2 = param_1[0x1a5];

      uVar3 = uVar2 & 0xfffff7ff;

      param_1[0x1a5] = uVar3;

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

        param_1[0x1a5] = uVar3 | 0x100;

        FUN_006a0430();

      }

    }

    if (param_2 == '\0') {

      uVar2 = param_1[0x1a5] & 0xfffffffb;

    }

    else {

      uVar2 = param_1[0x1a5] | 4;

    }

    param_1[0x1a5] = uVar2;

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

      param_1[0x1a5] = uVar2 & 0xffffff7f;

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

        param_1[0x1a5] = uVar2 & 0xffffff3f;

      }

      FUN_00466910(0);

      param_1[0x191] = extraout_EDX;

      param_1[0x192] = extraout_EDX;

    }

  }

  return;

}





// --- FUN_00468520 at 0x00468520 (size: 22) ---


void __thiscall FUN_00468520(int param_1,undefined4 param_2)



{

  FUN_00466a90(0x1a,param_1 + 0x6b4,param_2);

  return;

}





// --- FUN_00468540 at 0x00468540 (size: 45) ---


void __thiscall FUN_00468540(int param_1,undefined4 param_2)



{

  FUN_00466bf0(0x1b,param_1 + 0x6a4,param_2);

  FUN_00466bf0(0x1d,param_1 + 0x6b8,param_2);

  return;

}





// --- FUN_00468570 at 0x00468570 (size: 315) ---


undefined1 __thiscall FUN_00468570(int param_1,undefined4 param_2,int param_3,undefined4 *param_4)



{

  undefined4 uVar1;

  char cVar2;

  undefined1 uVar3;

  int iVar4;

  int local_14;

  undefined4 local_10;

  undefined4 local_c;

  undefined4 local_8;

  undefined4 local_4;

  

  uVar1 = param_3;

  local_14 = 0;

  local_4 = 0;

  cVar2 = FUN_00472ab0(param_3,&local_14,&local_4);

  if (cVar2 != '\0') {

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

      if (local_14 == *(int *)(param_1 + 0x628) + -1) goto LAB_00468603;

    }

    else if (local_14 == 0) {

LAB_00468603:

      *param_4 = uVar1;

      return 1;

    }

  }

  uVar3 = 0;

  param_3 = 0;

  cVar2 = FUN_00472f00(uVar1,&param_3);

  if (cVar2 != '\0') {

    local_10 = 0;

    local_c = 0;

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

      cVar2 = FUN_00472c00(uVar1,&local_10,&local_c);

    }

    else {

      cVar2 = FUN_00472c60(uVar1,&local_10,&local_c);

    }

    uVar3 = 0;

    if (cVar2 != '\0') {

      param_2 = 0;

      FUN_00472cf0(local_14,&param_2);

      iVar4 = FUN_004674f0(param_2,1);

      param_3 = param_3 + iVar4;

      local_8 = 0;

      FUN_00472cf0(local_10,&local_8);

      iVar4 = FUN_004674f0(local_8,1);

      param_3 = param_3 - iVar4;

      uVar3 = FUN_00473690(local_10,param_3,1,param_4);

    }

  }

  return uVar3;

}





// --- FUN_004686b0 at 0x004686B0 (size: 274) ---


undefined4 __fastcall FUN_004686b0(int *param_1)



{

  int iVar1;

  int iVar2;

  undefined1 uVar3;

  undefined4 uVar4;

  uint uVar5;

  int unaff_EBX;

  int local_18;

  int local_14;

  undefined1 local_10 [4];

  int iStack_c;

  

  uVar4 = 0;

  if ((param_1[0x1a5] & 0x100U) != 0) {

    local_14 = 0;

    local_18 = 0;

    (**(code **)(*param_1 + 0x34))(local_10);

    uVar3 = FUN_00473bc0((((iStack_c - param_1[0x1b6]) - param_1[0x1b5]) - local_14) + 1,

                         CONCAT31((int3)((uint)&local_18 >> 8),((byte)param_1[0x1a5] & 2) == 2),

                         &local_18,&stack0xffffffe4);

    local_18 = local_18 + param_1[0x1b6] + param_1[0x1b5];

    iVar1 = param_1[0x1b3];

    iVar2 = param_1[0x1b4];

    if ((param_1[0x1a5] & 0x800U) == 0) {

      param_1[0x1a0] = -1;

      param_1[0x1a3] = -1;

    }

    else {

      FUN_00467210(&local_18,&stack0xffffffe4);

    }

    FUN_00474af0(local_18,unaff_EBX + iVar2 + iVar1);

    FUN_00474480(param_1[0x17e],param_1[0x17f],1);

    uVar5 = param_1[0x1a5];

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

      uVar5 = uVar5 & 0xfffffeff;

      param_1[0x1a5] = uVar5;

    }

    uVar4 = CONCAT31((int3)(uVar5 >> 8),uVar3);

  }

  return uVar4;

}





// --- FUN_004687d0 at 0x004687D0 (size: 47) ---


void __thiscall FUN_004687d0(int param_1,char param_2)



{

  if (param_2 != '\0') {

    *(uint *)(param_1 + 0x694) = *(uint *)(param_1 + 0x694) | 0x400;

    FUN_004677e0();

    return;

  }

  *(uint *)(param_1 + 0x694) = *(uint *)(param_1 + 0x694) & 0xfffffbff;

  return;

}





// --- FUN_00468800 at 0x00468800 (size: 505) ---


undefined4 * __thiscall FUN_00468800(undefined4 *param_1,undefined4 param_2,undefined4 param_3)



{

  undefined4 uVar1;

  int iVar2;

  uint uVar3;

  uint uVar4;

  uint uVar5;

  undefined4 uVar6;

  

  FUN_00474150(param_2,param_3);

  param_1[0x182] = &PTR_FUN_0079ca88;

  *param_1 = &PTR_FUN_0079d198;

  param_1[0x182] = &PTR_FUN_0079d180;

  FUN_00473860();

  param_1[400] = 0;

  param_1[0x191] = 0;

  param_1[0x192] = 0;

  FUN_00473860();

  param_1[0x1a0] = 0xffffffff;

  param_1[0x1a3] = 0xffffffff;

  param_1[0x1a1] = 0;

  param_1[0x1a2] = 0;

  param_1[0x1a4] = 0;

  param_1[0x1a5] = 0x300;

  param_1[0x1a6] = 2;

  param_1[0x1a7] = 4;

  param_1[0x1a8] = 0;

  param_1[0x1a9] = DAT_00819ac8;

  param_1[0x1aa] = DAT_00819acc;

  param_1[0x1ab] = DAT_00819ad0;

  param_1[0x1ac] = DAT_00819ad4;

  param_1[0x1ad] = 0;

  param_1[0x1ae] = DAT_00819ac8;

  param_1[0x1af] = DAT_00819acc;

  param_1[0x1b0] = DAT_00819ad0;

  param_1[0x1b1] = DAT_00819ad4;

  iVar2 = FUN_005df4c4();

  uVar3 = FUN_005df4c4();

  uVar4 = FUN_005df4c4();

  uVar5 = FUN_005df4c4();

  uVar1 = DAT_0079d174;

  uVar6 = DAT_0079d170;

  param_1[0x1b8] = DAT_0079d170;

  param_1[0x1b2] = ((iVar2 << 8 | uVar3) << 8 | uVar4) << 8 | uVar5;

  param_1[0x1b3] = 0;

  param_1[0x1b4] = 0;

  param_1[0x1b5] = 0;

  param_1[0x1b6] = 0;

  param_1[0x1b9] = uVar1;

  param_1[0x1ba] = uVar6;

  param_1[0x1bb] = uVar1;

  param_1[0x1bc] = 0;

  param_1[0x1bd] = 0;

  param_1[0x1be] = 0;

  param_1[0x1bf] = 0;

  param_1[0x1c0] = 0;

  param_1[0x1c1] = 0;

  param_1[0x1c2] = 0;

  iVar2 = FUN_00415730(0x18,9,0x2e);

  param_1[0x1ad] = iVar2;

  if (iVar2 == 0) {

    uVar6 = FUN_00415730(3,9,0x2e);

    param_1[0x1ad] = uVar6;

  }

  FUN_004669d0();

  FUN_00467ae0();

  return param_1;

}





// --- FUN_00468a00 at 0x00468A00 (size: 30) ---


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



{

  FUN_004679f0();

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

    operator_delete(param_1);

  }

  return param_1;

}





// --- FUN_00468a50 at 0x00468A50 (size: 195) ---


void __thiscall FUN_00468a50(int param_1,int param_2)



{

  uint uVar1;

  

  if ((*(int *)(param_2 + 4) == param_1) && (*(int *)(param_2 + 8) == 0x2f)) {

    uVar1 = *(uint *)(param_1 + 0x694) & 1;

    if ((uVar1 != 0) || ((*(uint *)(param_1 + 0x694) & 4) != 0)) {

      if (uVar1 == 1) {

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

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

          FUN_004154a0();

        }

        else {

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

          FUN_00466790();

          FUN_00557ac0();

        }

      }

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

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

        FUN_00465f90(3);

        FUN_00474920(param_2);

        return;

      }

      FUN_00467bc0();

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

      FUN_00465fb0(3);

    }

  }

  FUN_00474920(param_2);

  return;

}





// --- FUN_00468b30 at 0x00468B30 (size: 75) ---


void __fastcall FUN_00468b30(int param_1)



{

  int iVar1;

  LONG LVar2;

  undefined4 extraout_ECX;

  undefined4 *puVar3;

  undefined4 uVar4;

  int local_4;

  

  if (*(char *)(param_1 + 0x694) < '\0') {

    local_4 = param_1;

    FUN_00467c30(&local_4);

    iVar1 = local_4;

    uVar4 = extraout_ECX;

    FUN_00402730(local_4);

    FUN_00439d50(uVar4);

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

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

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

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

    }

  }

  return;

}





// --- FUN_00468b80 at 0x00468B80 (size: 184) ---


uint __thiscall FUN_00468b80(int param_1,int param_2,uint param_3)



{

  int iVar1;

  char cVar2;

  int iVar3;

  uint *puVar4;

  uint local_c;

  undefined4 local_8;

  undefined4 local_4;

  

  FUN_004686b0();

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

  local_8 = 0;

  local_4 = 0;

  FUN_00472b30(*(int *)(param_1 + 0x5fc) + param_3,&local_8);

  FUN_00472cf0(local_8,&local_4);

  iVar3 = FUN_004674f0(local_4,1);

  local_c = 0;

  cVar2 = FUN_00473690(local_8,(iVar1 + param_2) - iVar3,1,&local_c);

  if (cVar2 != '\0') {

    puVar4 = &param_3;

    if (local_c <= *(uint *)(param_1 + 0x61c)) {

      puVar4 = &local_c;

    }

    return *puVar4;

  }

  return local_c;

}





// --- FUN_00468d20 at 0x00468D20 (size: 16) ---


void FUN_00468d20(void)



{

  FUN_00460270(0xc,&LAB_00468a20);

  return;

}





// --- FUN_00468d30 at 0x00468D30 (size: 240) ---


uint __thiscall FUN_00468d30(int param_1,undefined4 *param_2)



{

  undefined4 uVar1;

  uint uVar2;

  int iVar3;

  uint *puVar4;

  int local_c;

  int local_8;

  uint local_4;

  

  uVar1 = *param_2;

  local_c = 0;

  local_8 = 0;

  FUN_004686b0();

  uVar2 = FUN_004732a0(uVar1,&local_c,&local_8);

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

    return uVar2 & 0xffffff00;

  }

  if ((*(byte *)(param_1 + 0x694) & 2) == 0) {

    iVar3 = FUN_0069fe70();

    local_4 = (iVar3 - *(int *)(param_1 + 0x6d0)) - *(int *)(param_1 + 0x6cc);

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

      iVar3 = 0;

    }

    else {

      iVar3 = *(int *)(*(int *)(param_1 + 0x6b4) + 0x30);

    }

    puVar4 = (uint *)&param_2;

    if ((int)local_4 <= iVar3) {

      puVar4 = &local_4;

    }

    if ((*(int *)(param_1 + 0x5fc) <= local_8) &&

       ((int)(*puVar4 + local_8) <= (int)(*(int *)(param_1 + 0x5fc) + local_4))) {

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

    }

  }

  else {

    iVar3 = FUN_0069fe60();

    local_4 = (iVar3 - *(int *)(param_1 + 0x6d8)) - *(int *)(param_1 + 0x6d4);

    if ((*(int *)(param_1 + 0x5f8) <= local_c) &&

       (local_c + 2 <= (int)(*(int *)(param_1 + 0x5f8) + local_4))) {

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

    }

  }

  return local_4 & 0xffffff00;

}





// --- FUN_00468e20 at 0x00468E20 (size: 319) ---


undefined4 __thiscall FUN_00468e20(int param_1,uint param_2,uint param_3)



{

  uint *puVar1;

  uint uVar2;

  bool bVar3;

  undefined4 uVar4;

  char cVar5;

  uint *puVar6;

  int iVar7;

  

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

    cVar5 = '\0';

  }

  else {

    cVar5 = (**(code **)(*DAT_00837ff4 + 0x58))();

  }

  if ((param_3 == 1) ||

     ((((*(uint *)(param_1 + 0x694) & 0x40) != 0 || (cVar5 != '\0')) && (param_3 == 0)))) {

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

    if ((-1 < (char)uVar2) && ((uVar2 & 4) != 0)) {

      *(uint *)(param_1 + 0x694) = uVar2 | 0x80;

      FUN_004670f0(*(undefined4 *)(param_1 + 0x640));

    }

  }

  else if ((char)*(uint *)(param_1 + 0x694) < '\0') {

    FUN_00466910(0);

  }

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

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

  *puVar1 = param_2;

  puVar6 = &param_3;

  if (param_2 <= *(uint *)(param_1 + 0x61c)) {

    puVar6 = puVar1;

  }

  *puVar1 = *puVar6;

  iVar7 = FUN_00474280(1);

  if (iVar7 == 0) {

    iVar7 = FUN_00474280(0);

    if (iVar7 == 0) {

      bVar3 = false;

      goto LAB_00468ed2;

    }

  }

  bVar3 = true;

LAB_00468ed2:

  param_3 = *puVar1;

  cVar5 = FUN_00468d30(&param_3);

  if ((cVar5 == '\0') && ((bVar3 || ((*(byte *)(param_1 + 0x694) & 5) != 0)))) {

    FUN_00469440(*puVar1);

  }

  uVar4 = DAT_008379ac;

  *(undefined4 *)(param_1 + 0x6e0) = DAT_008379a8;

  *(undefined4 *)(param_1 + 0x6e4) = uVar4;

  if (*(char *)(param_1 + 0x694) < '\0') {

    FUN_00467150(*puVar1);

  }

  cVar5 = FUN_00460310();

  if (((cVar5 != '\0') && (uVar2 = *(uint *)(param_1 + 0x694), (uVar2 & 1) != 0)) &&

     ((uVar2 & 0x100) == 0)) {

    *(uint *)(param_1 + 0x694) = uVar2 | 0x100;

    FUN_006a0430();

  }

  return 1;

}





// --- FUN_00468f60 at 0x00468F60 (size: 37) ---


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



{

  undefined4 uVar1;

  

  uVar1 = FUN_00468b80(param_1,param_2);

  FUN_00468e20(uVar1,param_3);

  return;

}





// --- FUN_00468f90 at 0x00468F90 (size: 310) ---


uint __thiscall FUN_00468f90(int param_1,undefined4 param_2)



{

  uint uVar1;

  undefined4 uVar2;

  uint local_4;

  

  local_4 = *(uint *)(param_1 + 0x640);

  switch(param_2) {

  case 1:

    local_4 = *(uint *)(param_1 + 0x61c);

    uVar1 = FUN_00468e20(local_4,0);

    return uVar1;

  case 2:

    uVar1 = FUN_00467040(1,local_4,&local_4);

    break;

  case 3:

    uVar1 = FUN_00467040(0,local_4,&local_4);

    break;

  case 4:

    uVar2 = 1;

    goto LAB_00469014;

  case 5:

    uVar2 = 0;

LAB_00469014:

    FUN_00466570(uVar2);

    local_4 = FUN_00468b80(0,0);

    uVar1 = FUN_00468e20(local_4,0);

    return uVar1;

  case 6:

    uVar1 = FUN_00472ea0(local_4,&local_4);

    break;

  case 7:

    uVar1 = FUN_00472e40(local_4,&local_4);

    break;

  case 8:

    if (local_4 != 0) {

      local_4 = local_4 - 1;

      uVar1 = FUN_00468e20(local_4,0);

      return uVar1;

    }

  case 0:

    local_4 = 0;

    uVar1 = FUN_00468e20(0,0);

    return uVar1;

  case 9:

    local_4 = local_4 + 1;

    uVar1 = FUN_00468e20(local_4,0);

    return uVar1;

  case 10:

    uVar2 = 1;

    goto LAB_00469097;

  case 0xb:

    uVar2 = 0;

LAB_00469097:

    uVar1 = FUN_00468570(uVar2,local_4,&local_4);

    break;

  default:

    return local_4 & 0xffffff00;

  }

  if ((char)uVar1 != '\0') {

    uVar1 = FUN_00468e20(local_4,0);

  }

  return uVar1;

}





// --- FUN_00469100 at 0x00469100 (size: 21) ---


void __fastcall FUN_00469100(int param_1)



{

  FUN_00468e20(*(undefined4 *)(param_1 + 0x61c),0);

  return;

}





// --- FUN_00469120 at 0x00469120 (size: 15) ---


void FUN_00469120(undefined4 param_1)



{

  FUN_00468e20(param_1,0);

  return;

}





// --- FUN_00469130 at 0x00469130 (size: 777) ---


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



{

  wchar_t *pwVar1;

  ushort uVar2;

  int iVar3;

  char cVar4;

  short *psVar5;

  int iVar6;

  ushort *puVar7;

  LONG LVar8;

  undefined2 *puVar9;

  int *piVar10;

  uint uVar11;

  uint uVar12;

  uint uVar13;

  wchar_t *pwVar14;

  wchar_t *local_38;

  int *local_34;

  int local_30;

  uint local_2c;

  uint local_28;

  undefined1 auStack_24 [36];

  

  piVar10 = (int *)0x0;

  local_34 = (int *)0x0;

  local_2c = 0;

  local_30 = param_1;

  if (*(int *)(*param_2 + -4) == 1) {

    return 1;

  }

  do {

    uVar11 = local_2c;

    iVar6 = *param_2;

    if (local_2c < *(uint *)(iVar6 + -4)) {

      psVar5 = (short *)(iVar6 + local_2c * 2);

    }

    else {

      psVar5 = (short *)(iVar6 + -2 + *(uint *)(iVar6 + -4) * 2);

    }

    uVar13 = local_2c;

    if (*psVar5 == 0x3c) {

      local_38 = (wchar_t *)PTR_DAT_00818340;

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

      iVar6 = *param_2;

      uVar12 = *(uint *)(iVar6 + -4);

      uVar13 = uVar11;

      if (uVar11 < uVar12 - 1) {

        do {

          pwVar14 = local_38;

          if (uVar11 < uVar12) {

            puVar7 = (ushort *)(iVar6 + uVar11 * 2);

          }

          else {

            puVar7 = (ushort *)(iVar6 + -2 + uVar12 * 2);

          }

          uVar2 = *puVar7;

          local_28 = (uint)uVar2;

          if (uVar2 != 0) {

            iVar6 = *(int *)(local_38 + -2);

            if ((*(int *)(local_38 + -8) == 1) && (iVar6 + 1U <= *(uint *)(local_38 + -6))) {

              *(uint *)(local_38 + -2) = iVar6 + 1U;

              local_38[-0xffffffff00000004] = L'\xffff';

              local_38[-0xffffffff00000003] = L'\xffff';

            }

            else {

              pwVar1 = local_38 + -10;

              FUN_004022d0(iVar6);

              wcscpy(local_38,pwVar14);

              LVar8 = InterlockedDecrement((LONG *)(pwVar14 + -8));

              if ((LVar8 == 0) && (pwVar1 != (wchar_t *)0x0)) {

                (*(code *)**(undefined4 **)pwVar1)(1);

              }

            }

            wcsncpy(local_38 + iVar6 + -1,(wchar_t *)&local_28,1);

            local_38[*(int *)(local_38 + -2) + -1] = L'\0';

            uVar13 = local_2c;

          }

          piVar10 = local_34;

          if (uVar2 == 0x3e) {

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

              local_34 = (int *)FUN_00478880(&local_38);

              if (local_34 == (int *)0x0) break;

            }

            else {

              pwVar14 = local_38;

              InterlockedIncrement((LONG *)(local_38 + -8));

              (**(code **)(*piVar10 + 4))(pwVar14);

              LVar8 = InterlockedDecrement(piVar10 + 1);

              if (LVar8 == 0) {

                (**(code **)*piVar10)(1);

              }

              local_34 = (int *)0x0;

            }

            uVar13 = (uVar13 - 1) + *(int *)(local_38 + -2);

            local_2c = uVar13;

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

              pwVar14 = local_38 + -10;

              LVar8 = InterlockedDecrement((LONG *)(local_38 + -8));

              if (LVar8 != 0) {

                return 1;

              }

              if (pwVar14 == (wchar_t *)0x0) {

                return 1;

              }

              (*(code *)**(undefined4 **)pwVar14)(1);

              return 1;

            }

            break;

          }

          iVar6 = *param_2;

          uVar12 = *(uint *)(iVar6 + -4);

          uVar11 = uVar11 + 1;

        } while (uVar11 < uVar12 - 1);

      }

      pwVar14 = local_38 + -10;

      LVar8 = InterlockedDecrement((LONG *)(local_38 + -8));

      piVar10 = local_34;

      if ((LVar8 == 0) && (pwVar14 != (wchar_t *)0x0)) {

        (*(code *)**(undefined4 **)pwVar14)(1);

        piVar10 = local_34;

      }

    }

    if ((piVar10 == (int *)0x0) || (piVar10[2] != 0x10000001)) {

      iVar6 = local_30 + 0x6a4;

    }

    else {

      iVar6 = local_30 + 0x6b8;

    }

    iVar3 = *param_2;

    if (uVar13 < *(uint *)(iVar3 + -4)) {

      puVar9 = (undefined2 *)(iVar3 + uVar13 * 2);

    }

    else {

      puVar9 = (undefined2 *)(iVar3 + -2 + *(uint *)(iVar3 + -4) * 2);

    }

    FUN_00474e50(*puVar9,iVar6,*(undefined4 *)(local_30 + 0x6b4),piVar10);

    uVar11 = *(uint *)(param_3 + 4) & 0x7fffffff;

    if (*(uint *)(param_3 + 8) < uVar11) {

LAB_004693c8:

      FUN_00474c30(auStack_24);

      *(int *)(param_3 + 8) = *(int *)(param_3 + 8) + 1;

    }

    else {

      uVar11 = uVar11 + 1;

      if (uVar11 < 9) {

        uVar11 = 8;

      }

      else if (uVar11 < 0x4001) {

        iVar6 = 0x1f;

        if (uVar11 != 0) {

          for (; uVar11 >> iVar6 == 0; iVar6 = iVar6 + -1) {

          }

        }

        uVar12 = 1 << ((byte)iVar6 & 0x1f);

        local_28 = uVar11;

        if (uVar12 < uVar11) {

          uVar11 = uVar12 * 2;

        }

      }

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

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

      }

      cVar4 = FUN_004678e0(uVar11);

      if (cVar4 != '\0') goto LAB_004693c8;

    }

    FUN_00474be0();

    local_2c = uVar13 + 1;

    if (*(int *)(*param_2 + -4) - 1U <= local_2c) {

      return 1;

    }

  } while( true );

}





// --- FUN_00469440 at 0x00469440 (size: 413) ---


void __thiscall FUN_00469440(int param_1,int param_2)



{

  char cVar1;

  int iVar2;

  int *piVar3;

  int iVar4;

  int iVar5;

  int local_c;

  int local_8;

  int local_4;

  

  local_c = 0;

  local_8 = 0;

  FUN_004686b0();

  cVar1 = FUN_004732a0(param_2,&local_c,&local_8);

  if (cVar1 != '\0') {

    iVar2 = FUN_0069fe60();

    iVar5 = (iVar2 - *(int *)(param_1 + 0x6d8)) - *(int *)(param_1 + 0x6d4);

    iVar2 = FUN_0069fe70();

    local_4 = (iVar2 - *(int *)(param_1 + 0x6d0)) - *(int *)(param_1 + 0x6cc);

    if ((*(byte *)(param_1 + 0x694) & 2) == 0) {

      local_c = 0;

      piVar3 = &param_2;

      if (*(int *)(param_1 + 0x600) - iVar5 < 1) {

        piVar3 = &local_c;

      }

      local_c = *piVar3;

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

        param_2 = 0;

      }

      else {

        param_2 = *(int *)(*(int *)(param_1 + 0x6b4) + 0x30);

      }

      piVar3 = &param_2;

      if (local_4 <= param_2) {

        piVar3 = &local_4;

      }

      if (*(int *)(param_1 + 0x5fc) + local_4 < *piVar3 + local_8) {

        local_8 = local_8 + (*piVar3 - local_4);

      }

    }

    else {

      param_2 = *(int *)(param_1 + 0x604) - local_4;

      local_8 = 0;

      piVar3 = &param_2;

      if (param_2 < 1) {

        piVar3 = &local_8;

      }

      local_8 = *piVar3;

      if (*(int *)(param_1 + 0x5f8) + iVar5 < local_c + 2) {

        local_c = local_c + (2 - iVar5);

      }

    }

    FUN_00474480(local_c,local_8,0);

    piVar3 = DAT_00837ff4;

    if (((*(byte *)(param_1 + 0x694) & 0x40) != 0) && (DAT_00837ff4 != (int *)0x0)) {

      iVar2 = (**(code **)(*DAT_00837ff4 + 0x18))();

      iVar5 = (**(code **)(*piVar3 + 0x1c))();

      iVar4 = FUN_0069fe00();

      iVar4 = (iVar2 - *(int *)(param_1 + 0x6d4)) - iVar4;

      iVar2 = FUN_0069fe30();

      iVar2 = (iVar5 - *(int *)(param_1 + 0x6cc)) - iVar2;

      param_2 = FUN_00468b80(iVar4,iVar2);

      cVar1 = FUN_00468d30(&param_2);

      if (cVar1 != '\0') {

        FUN_00468f60(iVar4,iVar2,0);

      }

    }

  }

  return;

}





// --- FUN_004695e0 at 0x004695E0 (size: 32) ---


undefined4 __fastcall FUN_004695e0(int param_1)



{

  undefined4 uVar1;

  int local_4;

  

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

    return 1;

  }

  local_4 = *(int *)(param_1 + 0x61c) + -1;

  uVar1 = FUN_00468d30(&local_4);

  return uVar1;

}





// --- FUN_00469600 at 0x00469600 (size: 369) ---


void __thiscall FUN_00469600(int *param_1,int param_2,int param_3,uint param_4)



{

  int iVar1;

  uint uVar2;

  char cVar3;

  int iVar4;

  int iVar5;

  undefined4 uVar6;

  int iVar7;

  

  cVar3 = FUN_00460310();

  uVar2 = param_4;

  FUN_004741c0(param_2,param_3,param_4);

  if ((((((uint)param_1[0x155] >> 0x13 & 1) == 0) && (((uint)param_1[0x155] >> 0x12 & 1) == 0)) &&

      ((uVar2 == 7 || ((uVar2 == 5 || (uVar2 == 6)))))) && ((*(byte *)(param_1 + 0x29) & 1) != 0)) {

    iVar4 = FUN_0069fe00();

    iVar7 = param_1[0x1b5];

    iVar5 = FUN_0069fe30();

    iVar1 = param_1[0x1b3];

    if ((uVar2 == 7) && ((*(byte *)(param_1 + 0x1a5) & 5) != 0)) {

      param_4 = param_4 & 0xffffff00;

      FUN_00460cc0(0xd1,&param_4);

      if ((cVar3 == '\0') && ((char)param_4 != '\0')) {

        FUN_00467b60();

        return;

      }

      uVar6 = FUN_00468b80((param_2 - iVar7) - iVar4,(param_3 - iVar1) - iVar5);

      if ((char)param_1[0x1a5] < '\0') {

        iVar7 = param_1[0x191];

      }

      else {

        iVar7 = param_1[400];

      }

      FUN_00468e20(uVar6,2);

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

      if ((*(byte *)(param_1 + 0x1a5) & 4) != 0) {

        FUN_00466910(1);

        if ((*(byte *)(param_1 + 0x1a5) & 0x40) == 0) {

          param_1[0x1a5] = param_1[0x1a5] | 0x40;

        }

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

          cVar3 = (**(code **)(*DAT_00837ff4 + 0x58))();

          if (cVar3 != '\0') {

            FUN_004670f0(iVar7);

            FUN_00467150(param_1[400]);

            return;

          }

        }

        FUN_004670f0(param_1[400]);

      }

    }

  }

  return;

}





// --- FUN_00469780 at 0x00469780 (size: 251) ---


void __thiscall FUN_00469780(int param_1,int param_2,int param_3,uint param_4)



{

  char cVar1;

  int iVar2;

  int iVar3;

  undefined4 uVar4;

  uint *puVar5;

  bool bVar6;

  undefined1 local_24 [32];

  int *local_4;

  

  puVar5 = *(uint **)(*(int *)(param_1 + 400) + (param_4 % *(uint *)(param_1 + 0x198)) * 4);

  bVar6 = puVar5 == (uint *)0x0;

  if (!bVar6) {

    do {

      if (*puVar5 == param_4) break;

      puVar5 = (uint *)puVar5[1];

    } while (puVar5 != (uint *)0x0);

    bVar6 = puVar5 == (uint *)0x0;

  }

  FUN_00463a70(param_2,param_3,param_4);

  if (((*(byte *)(param_1 + 0x694) & 0x40) != 0) || (!bVar6)) {

    iVar2 = FUN_0069fe00();

    iVar2 = (param_2 - *(int *)(param_1 + 0x6d4)) - iVar2;

    iVar3 = FUN_0069fe30();

    iVar3 = (param_3 - *(int *)(param_1 + 0x6cc)) - iVar3;

    if ((*(byte *)(param_1 + 0x694) & 0x40) != 0) {

      uVar4 = FUN_00468b80(iVar2,iVar3);

      FUN_00468e20(uVar4,0);

      if ((*(byte *)(param_1 + 0x694) & 0x40) != 0) {

        *(uint *)(param_1 + 0x694) = *(uint *)(param_1 + 0x694) & 0xffffffbf;

      }

    }

    if (!bVar6) {

      uVar4 = FUN_00468b80(iVar2,iVar3);

      FUN_00474bc0();

      cVar1 = FUN_004737f0(uVar4,local_24);

      if ((cVar1 != '\0') && (local_4 != (int *)0x0)) {

        (**(code **)(*local_4 + 0x14))(param_4);

      }

      FUN_00474be0();

    }

  }

  return;

}





// --- FUN_00469880 at 0x00469880 (size: 100) ---


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



{

  int iVar1;

  int iVar2;

  int iVar3;

  undefined4 uVar4;

  

  if ((*(byte *)(param_1 + 0x694) & 0x40) == 0) {

    FUN_004633f0(param_2,param_3);

    return;

  }

  iVar2 = FUN_0069fe00();

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

  iVar3 = FUN_0069fe30();

  uVar4 = FUN_00468b80((param_2 - iVar1) - iVar2,(param_3 - *(int *)(param_1 + 0x6cc)) - iVar3);

  FUN_00468e20(uVar4,0);

  return;

}





// --- FUN_004698f0 at 0x004698F0 (size: 409) ---


undefined4 __thiscall

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



{

  int iVar1;

  int *piVar2;

  char cVar3;

  LONG LVar4;

  int iVar5;

  int *piVar6;

  undefined4 local_40;

  undefined4 local_3c;

  undefined4 local_38;

  

  piVar2 = param_4;

  piVar6 = param_3;

  *param_3 = 0;

  *param_4 = 0;

  FUN_0042e980(&param_4,0);

  if (param_4[-1] == 1) {

    piVar6 = param_4 + -5;

    LVar4 = InterlockedDecrement(param_4 + -4);

    if (LVar4 != 0) {

      return 1;

    }

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

      return 1;

    }

    (**(code **)*piVar6)(1);

    return 1;

  }

  local_40 = 0;

  local_3c = 0;

  local_38 = 0;

  FUN_00469130(&param_4,&local_40);

  FUN_00473860();

  FUN_00473550(0,&local_40);

  param_3 = (int *)0x0;

  if (param_5 == 1) {

    param_3 = (int *)FUN_0069fe60();

    goto LAB_004699f2;

  }

  if (param_5 == 2) {

    iVar5 = (**(code **)(*param_1 + 0xa0))();

    if (iVar5 != 0) {

      param_3 = (int *)FUN_0069fe60();

      goto LAB_004699f2;

    }

  }

  else {

    if (param_5 == 3) {

      param_3 = (int *)param_1[0x95];

      goto LAB_004699f2;

    }

    cVar3 = FUN_00460b30(0x3d,&param_3);

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

  }

  param_3 = (int *)FUN_0054fd20();

LAB_004699f2:

  iVar5 = param_1[0x1b6];

  iVar1 = param_1[0x1b5];

  *piVar6 = 0;

  *piVar2 = 0;

  FUN_00473bc0(((int)param_3 - iVar5) - iVar1,

               CONCAT31((int3)((uint)iVar5 >> 8),((byte)param_1[0x1a5] & 2) == 2),piVar6,piVar2);

  *piVar6 = *piVar6 + param_1[0x1b6] + param_1[0x1b5];

  *piVar2 = *piVar2 + param_1[0x1b4] + param_1[0x1b3];

  FUN_004738a0();

  FUN_00467890();

  piVar6 = param_4 + -5;

  LVar4 = InterlockedDecrement(param_4 + -4);

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

    (**(code **)*piVar6)(1);

  }

  return 1;

}





// --- FUN_00469a90 at 0x00469A90 (size: 358) ---


void __thiscall FUN_00469a90(int param_1,uint param_2,uint param_3,uint param_4)



{

  uint uVar1;

  char cVar2;

  uint uVar3;

  int iVar4;

  uint uVar5;

  int iVar6;

  int iVar7;

  

  uVar5 = param_2;

  if (*(uint *)(param_1 + 0x61c) <= param_2) {

    return;

  }

  if (*(uint *)(param_1 + 0x61c) < param_3) {

    return;

  }

  if (param_3 <= param_2) {

    return;

  }

  uVar3 = param_4;

  if ((char)param_4 != '\0') {

    FUN_004686b0();

    uVar3 = FUN_00468b80(*(undefined4 *)(param_1 + 0x5f8),*(undefined4 *)(param_1 + 0x5fc));

    if ((((uVar3 < param_2) && (uVar3 < param_3)) || (*(int *)(param_1 + 0x5fc) == 0)) ||

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

      param_4 = param_4 & 0xffffff00;

      uVar3 = param_4;

    }

    else {

      uVar3 = *(uint *)(param_1 + 0x694) & 2;

      param_4 = 1;

      if (uVar3 == 0) {

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

      }

      else {

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

      }

      if (uVar3 == 2) {

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

      }

      else {

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

      }

    }

  }

  iVar4 = FUN_00473460(uVar5,param_3);

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

  if (param_3 < uVar1) {

    uVar5 = uVar1 - iVar4;

  }

  else if (uVar1 <= uVar5) goto LAB_00469b71;

  FUN_00468e20(uVar5,0);

LAB_00469b71:

  if ((*(uint *)(param_1 + 0x694) & 0x100) == 0) {

    *(uint *)(param_1 + 0x694) = *(uint *)(param_1 + 0x694) | 0x100;

    FUN_006a0430();

  }

  if ((char)param_4 != '\0') {

    FUN_004686b0();

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

    iVar6 = *(int *)(param_1 + 0x5fc);

    if ((*(byte *)(param_1 + 0x694) & 2) == 0) {

      iVar6 = (*(int *)(param_1 + 0x604) - uVar3) + param_2;

    }

    else {

      iVar7 = (*(int *)(param_1 + 0x600) - uVar3) + param_2;

    }

    FUN_00474480(iVar7,iVar6,0);

  }

  if (iVar4 != 0) {

    FUN_00460410(0x44,0,0);

  }

  return;

}





// --- FUN_00469c00 at 0x00469C00 (size: 20) ---


void FUN_00469c00(undefined4 param_1,undefined4 param_2)



{

  FUN_00469a90(0,param_1,param_2);

  return;

}





// --- FUN_00469c20 at 0x00469C20 (size: 19) ---


void __fastcall FUN_00469c20(int param_1)



{

  FUN_00469a90(*(int *)(param_1 + 0x640),*(int *)(param_1 + 0x640) + 1,0);

  return;

}





// --- FUN_00469c40 at 0x00469C40 (size: 125) ---


void __fastcall FUN_00469c40(int param_1)



{

  uint uVar1;

  char cVar2;

  undefined4 local_8;

  undefined4 local_4;

  

  cVar2 = FUN_004671b0(&local_4,&local_8);

  if (cVar2 != '\0') {

    FUN_00469a90(local_4,local_8,0);

    if (*(char *)(param_1 + 0x694) < '\0') {

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

      *(uint *)(param_1 + 0x694) = uVar1 & 0xffffff7f;

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

        *(uint *)(param_1 + 0x694) = uVar1 & 0xffffff3f;

      }

      FUN_00466910(0);

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

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

    }

  }

  return;

}





// --- FUN_00469cc0 at 0x00469CC0 (size: 298) ---


void __thiscall FUN_00469cc0(int param_1,int param_2,byte param_3)



{

  undefined4 uVar1;

  byte bVar2;

  int iVar3;

  LONG LVar4;

  undefined4 *puVar5;

  undefined4 local_c;

  undefined4 local_8;

  undefined4 local_4;

  

  bVar2 = param_3;

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

    if ((*(byte *)(param_1 + 0x694) & 1) == 0) {

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

        FUN_00466910(0);

      }

    }

    else {

      FUN_00469c40();

    }

    local_c = 0;

    local_8 = 0;

    local_4 = 0;

    FUN_00469130(&param_2,&local_c);

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

      iVar3 = FUN_00473550(*(undefined4 *)(param_1 + 0x640),&local_c);

      FUN_00468e20(*(int *)(param_1 + 0x640) + iVar3,2);

    }

    else {

      FUN_00473550(*(undefined4 *)(param_1 + 0x61c),&local_c);

    }

    uVar1 = DAT_008379a8;

    *(undefined4 *)(param_1 + 0x6e4) = DAT_008379ac;

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

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

      FUN_004677e0();

    }

    if ((*(uint *)(param_1 + 0x694) & 0x100) == 0) {

      *(uint *)(param_1 + 0x694) = *(uint *)(param_1 + 0x694) | 0x100;

      FUN_006a0430();

    }

    FUN_00467890();

  }

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

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

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

    (**(code **)*puVar5)(1);

  }

  return;

}





// --- FUN_00469df0 at 0x00469DF0 (size: 37) ---


void __fastcall FUN_00469df0(int param_1)



{

  if (*(char *)(param_1 + 0x694) < '\0') {

    FUN_00468b30();

    if ((*(byte *)(param_1 + 0x694) & 1) != 0) {

      FUN_00469c40();

      return;

    }

  }

  return;

}





// --- FUN_00469f70 at 0x00469F70 (size: 37) ---


void FUN_00469f70(int *param_1)



{

  int iVar1;

  undefined4 uVar2;

  

  iVar1 = *param_1;

  uVar2 = 3;

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

  FUN_00469cc0(iVar1,uVar2);

  return;

}





// --- FUN_00469fa0 at 0x00469FA0 (size: 82) ---


void FUN_00469fa0(int param_1)



{

  int *piVar1;

  LONG LVar2;

  undefined4 *puVar3;

  int iVar4;

  undefined4 uVar5;

  

  piVar1 = (int *)FUN_0042e980(&param_1,0);

  iVar4 = *piVar1;

  uVar5 = 3;

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

  FUN_00469cc0(iVar4,uVar5);

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

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

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

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

  }

  return;

}





// --- FUN_0046a000 at 0x0046A000 (size: 98) ---


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



{

  int iVar1;

  undefined4 uVar2;

  

  FUN_00466a90(0x1a,param_1 + 0x6b4,param_3);

  FUN_00466bf0(0x1b,param_1 + 0x6a4,param_4);

  FUN_00466bf0(0x1d,param_1 + 0x6b8,param_4);

  iVar1 = *param_2;

  uVar2 = 3;

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

  FUN_00469cc0(iVar1,uVar2);

  return;

}





// --- FUN_0046a070 at 0x0046A070 (size: 143) ---


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



{

  int *piVar1;

  LONG LVar2;

  undefined4 *puVar3;

  int iVar4;

  undefined4 uVar5;

  

  FUN_00466a90(0x1a,param_1 + 0x6b4,param_3);

  uVar5 = param_4;

  FUN_00466bf0(0x1b,param_1 + 0x6a4,param_4);

  FUN_00466bf0(0x1d,param_1 + 0x6b8,uVar5);

  piVar1 = (int *)FUN_0042e980(&param_3,0);

  iVar4 = *piVar1;

  uVar5 = 3;

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

  FUN_00469cc0(iVar4,uVar5);

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

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

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

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

  }

  return;

}





// --- FUN_0046a100 at 0x0046A100 (size: 323) ---


void __fastcall FUN_0046a100(int param_1)



{

  int *piVar1;

  bool bVar2;

  int iVar3;

  undefined4 *puVar4;

  undefined4 *puVar5;

  int iStack_20;

  int iStack_1c;

  uint local_4;

  

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

    bVar2 = false;

    local_4 = 0;

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

      do {

        piVar1 = *(int **)(*(int *)(param_1 + 0x700) + local_4 * 4);

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

          if (piVar1[0x27] != DAT_0083e37c) break;

          if (local_4 < *(uint *)(param_1 + 0x708)) {

            iVar3 = *(uint *)(param_1 + 0x708) - 1;

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

            puVar4 = (undefined4 *)(*(int *)(param_1 + 0x700) + local_4 * 4);

            puVar5 = (undefined4 *)(*(int *)(param_1 + 0x700) + iVar3 * 4);

            if (puVar4 < puVar5) {

              iVar3 = ((uint)((int)puVar5 + (-1 - (int)puVar4)) >> 2) + 1;

              puVar5 = puVar4;

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

                *puVar5 = *puVar4;

                puVar5 = puVar5 + 1;

              }

            }

            *(undefined4 *)(*(int *)(param_1 + 0x700) + *(int *)(param_1 + 0x708) * 4) = 0;

          }

          iStack_1c = piVar1[0x25];

          iStack_20 = param_1 + 0x6b4;

          local_4 = local_4 - 1;

          FUN_00466a90(0x1a);

          iVar3 = piVar1[0x26];

          iStack_20 = param_1 + 0x6a4;

          iStack_1c = iVar3;

          FUN_00466bf0(0x1b);

          iStack_20 = param_1 + 0x6b8;

          iStack_1c = iVar3;

          FUN_00466bf0(0x1d);

          iStack_1c = 0;

          FUN_0042e980(&iStack_20,0);

          FUN_00469cc0();

          iStack_1c = 1;

          bVar2 = true;

          iStack_20 = 0x46a200;

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

        }

        local_4 = local_4 + 1;

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

    }

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

      iStack_1c = 3;

      iStack_20 = 0x46a226;

      FUN_00465fb0();

    }

    if (bVar2) {

      iStack_1c = 0;

      iStack_20 = 0;

      FUN_00460410(0x13);

    }

  }

  return;

}





// --- FUN_0046a250 at 0x0046A250 (size: 249) ---


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



void __fastcall FUN_0046a250(int param_1)



{

  bool bVar1;

  double dVar2;

  double dVar3;

  undefined4 uVar4;

  undefined4 uVar5;

  undefined4 uVar6;

  char cVar7;

  UINT UVar8;

  uint uVar9;

  int iVar10;

  

  FUN_0046a100();

  if ((*(byte *)(param_1 + 0x694) & 5) == 0) {

    return;

  }

  cVar7 = FUN_00460310();

  uVar6 = DAT_008379ac;

  uVar4 = DAT_008379a8;

  if (cVar7 == '\0') {

    return;

  }

  UVar8 = GetCaretBlinkTime();

  uVar5 = DAT_008379a8;

  dVar3 = (double)(int)UVar8;

  if ((int)UVar8 < 0) {

    dVar3 = dVar3 + (double)_DAT_0079920c;

  }

  if (*(double *)(param_1 + 0x6e0) <= *(double *)(param_1 + 0x6e8)) {

    dVar2 = (double)CONCAT44(uVar6,uVar4) - *(double *)(param_1 + 0x6e8);

    if (dVar3 * (double)_DAT_0079a76c < dVar2 == (dVar3 * (double)_DAT_0079a76c == dVar2)) {

      return;

    }

    if ((*(uint *)(param_1 + 0x694) & 0x200) != 0) {

      bVar1 = false;

      goto LAB_0046a2e5;

    }

  }

  bVar1 = true;

LAB_0046a2e5:

  *(undefined4 *)(param_1 + 0x6ec) = DAT_008379ac;

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

  if (bVar1) {

    uVar9 = *(uint *)(param_1 + 0x694) | 0x200;

  }

  else {

    uVar9 = *(uint *)(param_1 + 0x694) & 0xfffffdff;

  }

  *(uint *)(param_1 + 0x694) = uVar9;

  iVar10 = *(int *)(param_1 + 0x6f8) - *(int *)(param_1 + 0x6f0);

  if ((iVar10 != -1 && -1 < iVar10 + 1) &&

     (iVar10 = *(int *)(param_1 + 0x6fc) - *(int *)(param_1 + 0x6f4),

     iVar10 != -1 && -1 < iVar10 + 1)) {

    FUN_0069ff00(param_1 + 0x6f0);

  }

  return;

}





// --- FUN_0046a350 at 0x0046A350 (size: 24) ---


void FUN_0046a350(undefined4 param_1)



{

  FUN_00467ae0();

  FUN_00469fa0(param_1);

  return;

}





// --- FUN_0046a370 at 0x0046A370 (size: 34) ---


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



{

  FUN_00467ae0();

  FUN_0046a070(param_1,param_2,param_3);

  return;

}





// --- FUN_0046a3a0 at 0x0046A3A0 (size: 334) ---


void __fastcall FUN_0046a3a0(int param_1)



{

  int iVar1;

  char cVar2;

  LONG LVar3;

  uint uVar4;

  uint uVar5;

  undefined4 *puVar6;

  bool bVar7;

  undefined *local_c;

  int local_8;

  int local_4;

  

  if ((*(byte *)(param_1 + 0x694) & 1) != 0) {

    local_c = PTR_DAT_00818340;

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

    cVar2 = FUN_0043ab50(&local_c);

    if ((cVar2 != '\0') && (*(int *)(local_c + -4) != 1)) {

      if (*(char *)(param_1 + 0x694) < '\0') {

        FUN_00469c40();

      }

      FUN_00402730(&DAT_0079d2e0);

      FUN_00402730(&DAT_0079d2d8);

      FUN_0040d870(&local_8,&local_4);

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

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

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

      }

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

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

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

      }

      uVar4 = *(uint *)(local_c + -4);

      uVar5 = 0;

      if (uVar4 != 0) {

        bVar7 = uVar4 != 0;

        do {

          iVar1 = uVar4 * 2 + -2;

          if (bVar7) {

            iVar1 = uVar5 * 2;

          }

          (**(code **)(*(int *)(param_1 + 0x608) + 0x10))(*(undefined2 *)(local_c + iVar1));

          uVar4 = *(uint *)(local_c + -4);

          uVar5 = uVar5 + 1;

          bVar7 = true;

        } while (uVar5 < uVar4);

      }

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

      cVar2 = FUN_00468d30(&local_4);

      if (cVar2 == '\0') {

        FUN_00469440(*(undefined4 *)(param_1 + 0x640));

      }

    }

    puVar6 = (undefined4 *)(local_c + -0x14);

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

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

      (**(code **)*puVar6)(1);

    }

  }

  return;

}





// --- FUN_0046a730 at 0x0046A730 (size: 15) ---


void FUN_0046a730(int param_1)



{

  if (param_1 == 3) {

    FUN_0046a250();

  }

  return;

}





// --- FUN_0046a740 at 0x0046A740 (size: 75) ---


void FUN_0046a740(undefined4 param_1)



{

  undefined1 local_90 [144];

  

  FUN_0042dc80();

  FUN_0042cbe0(param_1,1);

  FUN_00467ae0();

  FUN_00469fa0(local_90);

  FUN_0042e590();

  return;

}





// --- FUN_0046a790 at 0x0046A790 (size: 91) ---


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



{

  undefined1 local_90 [144];

  

  FUN_0042dc80();

  FUN_0042cbe0(param_1,1);

  FUN_00467ae0();

  FUN_0046a070(local_90,param_2,param_3);

  FUN_0042e590();

  return;

}





// --- FUN_0046a7f0 at 0x0046A7F0 (size: 121) ---


void __fastcall FUN_0046a7f0(int param_1)



{

  undefined4 uVar1;

  LONG LVar2;

  undefined4 *puVar3;

  int local_4;

  

  local_4 = param_1;

  FUN_00466a90(0x1a,param_1 + 0x6b4,0);

  FUN_00466bf0(0x1b,param_1 + 0x6a4,0);

  FUN_00466bf0(0x1d,param_1 + 0x6b8,0);

  if (DAT_00819a70 != '\0') {

    uVar1 = FUN_004668a0(&local_4);

    FUN_0046a740(uVar1);

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

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

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

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

    }

  }

  return;

}





// --- FUN_0046a8d0 at 0x0046A8D0 (size: 1186) ---


void __thiscall FUN_0046a8d0(int *param_1,int param_2)



{

  char cVar1;

  undefined4 uVar2;

  int iVar3;

  undefined4 *puVar4;

  uint local_ac;

  undefined1 local_a5;

  undefined4 local_a4;

  undefined4 local_a0;

  undefined4 local_9c;

  undefined4 local_98;

  undefined1 auStack_94 [4];

  undefined1 local_90 [4];

  int local_8c;

  int local_88;

  char local_c;

  

  FUN_004749f0(param_2);

  uVar2 = FUN_00429a00();

  switch(uVar2) {

  case 0x14:

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

      (**(code **)(**(int **)(param_2 + 4) + 0xa8))(&local_ac);

    }

    FUN_00467490(local_ac);

    return;

  case 0x15:

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

      (**(code **)(**(int **)(param_2 + 4) + 0xa8))(&local_ac);

    }

    FUN_004674c0(local_ac);

    return;

  case 0x16:

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

      (**(code **)(**(int **)(param_2 + 4) + 0x70))(&local_ac);

    }

    FUN_00468360(local_ac);

    goto LAB_0046a985;

  case 0x17:

    FUN_0042dc80();

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

      (**(code **)(**(int **)(param_2 + 4) + 0xc0))(local_90);

    }

    if (((local_c != '\x01') && (local_8c == 0)) && (local_88 == DAT_0083e318)) {

      FUN_00467ae0();

      FUN_0042e590();

      return;

    }

    FUN_0046a350(local_90);

    FUN_0042e590();

    return;

  case 0x18:

  case 0x19:

  case 0x1c:

  case 0x2a:

  case 0x2b:

  case 0x2c:

  case 0x2d:

  case 0x2e:

  case 0x2f:

  case 0x30:

  case 0x31:

  case 0x32:

  case 0x33:

  case 0x34:

  case 0x35:

  case 0x36:

  case 0x37:

  case 0x38:

  case 0x39:

  case 0x3a:

  case 0x3b:

  case 0x3c:

  case 0x3d:

  case 0x3e:

  case 0x3f:

  case 0x40:

  case 0x41:

  case 0x42:

  case 0x43:

  case 0x44:

  case 0x45:

  case 0x46:

  case 0x47:

  case 0x48:

  case 0x49:

  case 0x4a:

  case 0x4b:

  case 0x4c:

  case 0x4d:

  case 0x4e:

  case 0x4f:

  case 0x50:

  case 0x51:

  case 0x52:

  case 0x53:

  case 0x54:

  case 0x55:

  case 0x56:

  case 0x57:

  case 0x58:

  case 0x59:

  case 0x5a:

  case 0x5b:

  case 0x5c:

  case 0x5d:

  case 0x5e:

  case 0x5f:

  case 0x60:

  case 0x61:

  case 0x62:

  case 99:

  case 100:

  case 0x65:

  case 0x66:

  case 0x67:

  case 0x68:

  case 0x69:

  case 0x6a:

  case 0x6b:

  case 0x6c:

  case 0x6d:

  case 0x6e:

  case 0x6f:

  case 0x70:

  case 0x71:

  case 0x72:

  case 0x73:

  case 0x74:

  case 0x75:

  case 0x76:

  case 0x77:

  case 0x78:

  case 0x79:

  case 0x7a:

  case 0x7b:

  case 0x7c:

  case 0x7d:

  case 0x7e:

  case 0x7f:

  case 0x80:

  case 0x81:

  case 0x82:

  case 0x83:

  case 0x84:

  case 0x85:

  case 0x86:

  case 0x87:

  case 0x88:

  case 0x89:

  case 0x8a:

  case 0x8b:

  case 0x8c:

  case 0x8d:

  case 0x8e:

  case 0x8f:

  case 0x90:

  case 0x91:

  case 0x92:

  case 0x93:

  case 0x94:

  case 0x95:

  case 0x96:

  case 0x97:

  case 0x98:

  case 0x99:

  case 0x9a:

  case 0x9b:

  case 0x9c:

  case 0x9d:

  case 0x9e:

  case 0x9f:

  case 0xa0:

  case 0xa1:

  case 0xa2:

  case 0xa3:

  case 0xa4:

  case 0xa5:

  case 0xa6:

  case 0xa7:

  case 0xa8:

  case 0xa9:

  case 0xaa:

  case 0xab:

  case 0xac:

  case 0xad:

  case 0xae:

  case 0xaf:

  case 0xb0:

  case 0xb1:

  case 0xb2:

  case 0xb3:

  case 0xb4:

  case 0xb5:

  case 0xb6:

  case 0xb7:

  case 0xb8:

  case 0xb9:

  case 0xba:

  case 0xbb:

  case 0xbc:

  case 0xbd:

  case 0xbe:

  case 0xbf:

  case 0xc0:

  case 0xc1:

  case 0xc2:

  case 0xc3:

  case 0xc4:

  case 0xc5:

  case 0xc6:

  case 200:

  case 0xc9:

  case 0xca:

    return;

  case 0x1e:

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

      (**(code **)(**(int **)(param_2 + 4) + 0x78))(&local_ac);

    }

    param_1[0x18b] = local_ac;

    return;

  case 0x1f:

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

      (**(code **)(**(int **)(param_2 + 4) + 0x70))(&local_ac);

    }

    FUN_00466730(local_ac);

    return;

  case 0x20:

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

      (**(code **)(**(int **)(param_2 + 4) + 0x70))(&local_ac);

    }

    FUN_00468400(local_ac);

    return;

  case 0x21:

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

      (**(code **)(**(int **)(param_2 + 4) + 0x70))(&local_ac);

    }

    FUN_00466760(local_ac);

    return;

  case 0x22:

    local_a4 = DAT_00819ad8;

    local_98 = DAT_00819ae4;

    local_a0 = DAT_00819adc;

    local_9c = DAT_00819ae0;

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

      (**(code **)(**(int **)(param_2 + 4) + 0x98))(&local_a4);

    }

    iVar3 = FUN_00424000();

    param_1[0x1b2] = iVar3;

  case 0x1a:

  case 0x1b:

  case 0x1d:

    FUN_0046a7f0();

    return;

  case 0x23:

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

      (**(code **)(**(int **)(param_2 + 4) + 0x78))(&local_ac);

    }

    param_1[0x1b5] = local_ac;

    break;

  case 0x24:

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

      (**(code **)(**(int **)(param_2 + 4) + 0x78))(&local_ac);

    }

    param_1[0x1b6] = local_ac;

    break;

  case 0x25:

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

      (**(code **)(**(int **)(param_2 + 4) + 0x78))(&local_ac);

    }

    param_1[0x1b3] = local_ac;

    break;

  case 0x26:

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

      (**(code **)(**(int **)(param_2 + 4) + 0x78))(&local_ac);

    }

    param_1[0x1b4] = local_ac;

    break;

  case 0x27:

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

      (**(code **)(**(int **)(param_2 + 4) + 0x70))(&local_ac);

    }

    FUN_00468450(local_ac);

LAB_0046a985:

    iVar3 = *param_1;

    uVar2 = (**(code **)(iVar3 + 0x124))();

    (**(code **)(iVar3 + 0x110))(uVar2);

    return;

  case 0x28:

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

      (**(code **)(**(int **)(param_2 + 4) + 0x70))(&local_a5);

    }

    *(undefined1 *)(param_1 + 0x18c) = local_a5;

    return;

  case 0x29:

    local_ac = local_ac & 0xffffff00;

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

      (**(code **)(**(int **)(param_2 + 4) + 0x70))(&local_ac);

    }

    FUN_004687d0(local_ac);

    return;

  case 199:

    FUN_0042dc80();

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

      (**(code **)(**(int **)(param_2 + 4) + 0xc0))(local_90);

    }

    uVar2 = FUN_0042ce00(1);

    FUN_00467710(uVar2);

    FUN_004733e0();

    cVar1 = FUN_0042ce00(1);

    if (cVar1 == '\0') {

      param_1[0x1a1] = 0;

      param_1[0x1a2] = 0;

      FUN_0042e590();

      return;

    }

    FUN_00468520(0);

    FUN_00468540(0);

    puVar4 = &local_a4;

    local_a4 = 0;

    local_a0 = 0;

    local_9c = 0;

    uVar2 = FUN_0042e980(auStack_94,0);

    FUN_00469130(uVar2,puVar4);

    FUN_004011b0();

    FUN_00473550(0,&local_a4);

    FUN_00473bc0(0x7fffffff,1,param_1 + 0x1a1,param_1 + 0x1a2);

    FUN_00467890();

    FUN_0042e590();

    return;

  case 0xcb:

    local_ac = (uint)local_ac._1_3_ << 8;

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

      (**(code **)(**(int **)(param_2 + 4) + 0x70))(&local_ac);

    }

    FUN_00467780(local_ac);

    return;

  case 0xcc:

    local_ac = (uint)local_ac._1_3_ << 8;

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

      (**(code **)(**(int **)(param_2 + 4) + 0x70))(&local_ac);

    }

    FUN_004677b0(local_ac);

    return;

  default:

    return;

  }

  FUN_004669d0();

  FUN_00466980(1);

  return;

}





// --- FUN_0046af30 at 0x0046AF30 (size: 119) ---


void __thiscall FUN_0046af30(int param_1,int param_2)



{

  int iVar1;

  int *piVar2;

  

  iVar1 = FUN_00429a00();

  if (iVar1 == 0xb1) {

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

      piVar2 = (int *)FUN_00463c00(*(int *)(param_1 + 0x5f0));

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

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

      }

    }

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

      (**(code **)(**(int **)(param_2 + 4) + 0xa8))((undefined4 *)(param_1 + 0x5f0));

    }

    piVar2 = (int *)FUN_00463c00(*(undefined4 *)(param_1 + 0x5f0));

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

      (**(code **)(*piVar2 + 0x9c))(6);

    }

  }

  FUN_00462e60(param_2);

  return;

}





// --- FUN_0046b030 at 0x0046B030 (size: 36) ---


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



{

  *param_1 = &PTR_FUN_0079d2e8;

  FUN_00464e00();

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

    operator_delete(param_1);

  }

  return param_1;

}





// --- FUN_0046b060 at 0x0046B060 (size: 16) ---


void FUN_0046b060(void)



{

  FUN_00460270(0x11,&LAB_0046aeb0);

  return;

}





// --- FUN_0046b070 at 0x0046B070 (size: 77) ---


bool FUN_0046b070(int *param_1)



{

  char cVar1;

  char cVar2;

  

  cVar1 = FUN_004625b0(param_1);

  FUN_00425ba0();

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

    return false;

  }

  cVar2 = FUN_00427240(0xb,param_1);

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

  return cVar2 != '\0' && cVar1 != '\0';

}





// --- FUN_0046b0c0 at 0x0046B0C0 (size: 84) ---


undefined4 * __thiscall FUN_0046b0c0(undefined4 *param_1,undefined4 param_2,undefined4 param_3)



{

  FUN_00464900(param_2,param_3);

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

  *param_1 = &PTR_FUN_0079d428;

  param_1[0x17d] = 0;

  param_1[0x17e] = 0;

  param_1[0x17f] = 0;

  param_1[0x180] = 0;

  param_1[0x155] = param_1[0x155] | 0x2000;

  param_1[0x181] = 0xffffffff;

  return param_1;

}





// --- FUN_0046b170 at 0x0046B170 (size: 169) ---


undefined4 __thiscall FUN_0046b170(int param_1,undefined4 *param_2)



{

  int iVar1;

  char cVar2;

  int local_4;

  

  if ((*(int *)(param_1 + 0x98) != 0) &&

     (iVar1 = *(int *)(*(int *)(param_1 + 0x98) + 8), iVar1 != 0)) {

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

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

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

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

    local_4 = 0;

    param_2 = (undefined4 *)0x0;

    cVar2 = FUN_00441950(&local_4,&param_2,(undefined4 *)(param_1 + 0x5f4),0);

    if (cVar2 != '\0') {

      iVar1 = *(int *)(iVar1 + 0xa0) * (int)param_2 + local_4;

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

      FUN_00460410(0x30,iVar1,0);

      FUN_006a0430();

      return 1;

    }

  }

  return 0;

}





// --- FUN_0046b220 at 0x0046B220 (size: 84) ---


bool __thiscall FUN_0046b220(int param_1,uint *param_2,undefined4 param_3)



{

  int iVar1;

  uint uVar2;

  uint uVar3;

  char cVar4;

  

  if ((((*(int *)(param_1 + 0x98) != 0) &&

       (iVar1 = *(int *)(*(int *)(param_1 + 0x98) + 8), iVar1 != 0)) &&

      (uVar2 = *(uint *)(iVar1 + 0xa0), uVar2 != 0)) &&

     (uVar3 = *param_2, uVar3 < *(int *)(iVar1 + 0xa4) * uVar2)) {

    cVar4 = FUN_004418d0(param_3,uVar3 % uVar2,uVar3 / uVar2);

    return cVar4 != '\0';

  }

  return false;

}





// --- FUN_0046b280 at 0x0046B280 (size: 126) ---


void __fastcall FUN_0046b280(int *param_1)



{

  int *piVar1;

  char cVar2;

  int *piVar3;

  int unaff_ESI;

  int *unaff_retaddr;

  int iStack_20;

  int iStack_1c;

  int iStack_18;

  undefined1 local_10 [16];

  

  piVar3 = (int *)(**(code **)(*param_1 + 0x34))(local_10);

  piVar1 = param_1 + 0x181;

  *piVar1 = ((piVar3[2] - *piVar3) + 1) * unaff_retaddr[1] + *unaff_retaddr;

  cVar2 = FUN_0046b220(piVar1,&stack0xffffffdc);

  if (cVar2 != '\0') {

    param_1[0x17d] = unaff_ESI;

    param_1[0x17e] = iStack_20;

    param_1[0x17f] = iStack_1c;

    param_1[0x180] = iStack_18;

  }

  FUN_00460410(0x30,*piVar1,0);

  FUN_006a0430();

  return;

}





// --- FUN_0046b300 at 0x0046B300 (size: 32) ---


undefined4 __fastcall FUN_0046b300(int param_1)



{

  char cVar1;

  

  cVar1 = FUN_00460290();

  if ((cVar1 == '\0') && (*(int *)(param_1 + 0x400) == 0xd)) {

    return 0;

  }

  return 1;

}





// --- FUN_0046b400 at 0x0046B400 (size: 16) ---


void FUN_0046b400(void)



{

  FUN_00460270(0x10,&LAB_0046b140);

  return;

}





// --- FUN_0046b410 at 0x0046B410 (size: 36) ---


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



{

  *param_1 = &PTR_FUN_0079d428;

  FUN_00464e00();

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

    operator_delete(param_1);

  }

  return param_1;

}





// --- FUN_0046b510 at 0x0046B510 (size: 77) ---


bool FUN_0046b510(int *param_1)



{

  char cVar1;

  char cVar2;

  

  cVar1 = FUN_004625b0(param_1);

  FUN_00425ba0();

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

    return false;

  }

  cVar2 = FUN_00427240(3,param_1);

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

  return cVar2 != '\0' && cVar1 != '\0';

}





// --- FUN_0046b560 at 0x0046B560 (size: 79) ---


undefined4 FUN_0046b560(undefined4 param_1,undefined4 param_2,undefined4 param_3)



{

  undefined4 uVar1;

  

  if (DAT_0083e470 == (code *)0x0) {

    if (DAT_0083e468 == (HMODULE)0x0) {

      DAT_0083e468 = LoadLibraryA("Trowser.dll");

    }

    DAT_0083e470 = (code *)(*(code *)PTR_FUN_00837388)(DAT_0083e468,"RedirectWindowDC");

    if (DAT_0083e470 == (code *)0x0) {

      return 0x8000ffff;

    }

  }

  uVar1 = (*DAT_0083e470)(param_1,param_2,param_3);

  return uVar1;

}





// --- FUN_0046b5b0 at 0x0046B5B0 (size: 150) ---


undefined4 * __thiscall FUN_0046b5b0(undefined4 *param_1,undefined4 param_2,undefined4 param_3)



{

  code *pcVar1;

  bool bVar2;

  

  FUN_00464900(param_2,param_3);

  pcVar1 = DAT_0083e46c;

  bVar2 = DAT_0083e46c == (code *)0x0;

  *param_1 = &PTR_FUN_0079d5c8;

  param_1[0x17c] = &PTR_LAB_0079d5bc;

  param_1[0x17d] = &PTR_LAB_0079d59c;

  param_1[0x17e] = 0;

  *(byte *)((int)param_1 + 0x5fd) = ~(byte)((uint)param_1[0x29] >> 1) & 1;

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

  if (bVar2) {

    if (DAT_0083e468 == (HMODULE)0x0) {

      DAT_0083e468 = LoadLibraryA("Trowser.dll");

    }

    pcVar1 = (code *)(*(code *)PTR_FUN_00837388)(DAT_0083e468,"CreateBrowserControl");

    DAT_0083e46c = pcVar1;

    if (pcVar1 == (code *)0x0) {

      return param_1;

    }

  }

  (*pcVar1)(param_1 + 0x17e);

  return param_1;

}





// --- FUN_0046b720 at 0x0046B720 (size: 51) ---


void __fastcall FUN_0046b720(int param_1)



{

  undefined4 uVar1;

  undefined4 uVar2;

  

  FUN_00463fb0();

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

    uVar1 = FUN_0069fe00();

    uVar2 = FUN_0069fe30();

    (**(code **)(**(int **)(param_1 + 0x5f8) + 0x10))(uVar1,uVar2);

  }

  return;

}





// --- FUN_0046b790 at 0x0046B790 (size: 159) ---


undefined4 __fastcall FUN_0046b790(int param_1)



{

  int iVar1;

  char cVar2;

  undefined4 uVar3;

  undefined4 uVar4;

  undefined4 uVar5;

  undefined4 uVar6;

  

  uVar3 = FUN_0069fe00();

  uVar4 = FUN_0069fe30();

  uVar5 = FUN_0069fe60();

  uVar6 = FUN_0069fe70();

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

    cVar2 = (**(code **)(**(int **)(param_1 + 0x5f8) + 0xc))

                      (DAT_008381a4,uVar3,uVar4,uVar5,uVar6,param_1 + 0x5f4);

    if (cVar2 != '\0') {

      uVar3 = (**(code **)(**(int **)(param_1 + 0x5f8) + 0x1c))(1,param_1 + 0x5f0);

      FUN_0046b560(uVar3);

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

      uVar3 = FUN_004603a0();

      (**(code **)(iVar1 + 0x18))(uVar3);

      return 1;

    }

  }

  return 0;

}





// --- FUN_0046b860 at 0x0046B860 (size: 84) ---


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



{

  int *piVar1;

  

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

  *param_1 = &PTR_FUN_0079d5c8;

  param_1[0x17c] = &PTR_LAB_0079d5bc;

  param_1[0x17d] = &PTR_LAB_0079d59c;

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

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

    param_1[0x17e] = 0;

  }

  FUN_00464e00();

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

    operator_delete(param_1);

  }

  return param_1;

}





// --- FUN_0046b8c0 at 0x0046B8C0 (size: 16) ---


void FUN_0046b8c0(void)



{

  FUN_00460270(0xe,&LAB_0046b670);

  return;

}





// --- FUN_0046b8d0 at 0x0046B8D0 (size: 30) ---


void FUN_0046b8d0(void)



{

  FUN_0069fe70();

  FUN_0069fe60();

  FUN_0046b790();

  FUN_00462d70();

  return;

}





// --- FUN_0046b940 at 0x0046B940 (size: 77) ---


bool FUN_0046b940(int *param_1)



{

  char cVar1;

  char cVar2;

  

  cVar1 = FUN_004625b0(param_1);

  FUN_00425ba0();

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

    return false;

  }

  cVar2 = FUN_00427240(2,param_1);

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

  return cVar2 != '\0' && cVar1 != '\0';

}





// --- FUN_0046b990 at 0x0046B990 (size: 145) ---


void __thiscall FUN_0046b990(int param_1,undefined *param_2)



{

  int iVar1;

  char cVar2;

  int iVar3;

  LONG LVar4;

  undefined4 *puVar5;

  

  iVar1 = (int)param_2;

  FUN_00462e60(param_2);

  iVar3 = FUN_00429a00();

  if ((iVar3 == 0xad) && (*(int *)(param_1 + 0x5f8) != 0)) {

    param_2 = PTR_DAT_00818344;

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

    if (*(int **)(iVar1 + 4) != (int *)0x0) {

      cVar2 = (**(code **)(**(int **)(iVar1 + 4) + 0xa0))(&param_2);

      if (cVar2 != '\0') {

        (**(code **)(**(int **)(param_1 + 0x5f8) + 0x20))(param_2,0,0,0,0,0);

      }

    }

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

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

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

      (**(code **)*puVar5)(1);

    }

  }

  return;

}





// --- FUN_0046ba90 at 0x0046BA90 (size: 214) ---


void __thiscall FUN_0046ba90(int *param_1,undefined4 *param_2)



{

  int iVar1;

  undefined4 uStack_4;

  

  uStack_4 = param_1;

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

  FUN_00460cc0(0x2c,(int)&uStack_4 + 2);

  FUN_00460cc0(0x2b,(int)&uStack_4 + 3);

  FUN_00460cc0(0x2d,&uStack_4);

  FUN_00460cc0(0x2a,(int)&uStack_4 + 1);

  if (uStack_4._2_1_ == '\0') {

    if (uStack_4._3_1_ == '\0') {

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

        if (uStack_4._1_1_ == '\0') {

          return;

        }

        iVar1 = 6;

      }

      else {

        iVar1 = 2;

      }

    }

    else if ((char)uStack_4 == '\0') {

      iVar1 = 8 - (uint)(uStack_4._1_1_ != '\0');

    }

    else {

      iVar1 = 1;

    }

  }

  else if ((char)uStack_4 == '\0') {

    iVar1 = (uStack_4._1_1_ != '\0') + 4;

  }

  else {

    iVar1 = 3;

  }

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

  FUN_0045fd80(iVar1,*param_2,param_2[1]);

  (**(code **)(*param_1 + 0x9c))(3);

  return;

}





// --- FUN_0046bb70 at 0x0046BB70 (size: 43) ---


void __fastcall FUN_0046bb70(int *param_1)



{

  int iVar1;

  

  (**(code **)(*param_1 + 0x9c))(1);

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

  iVar1 = (**(code **)(*param_1 + 0xa0))();

  if (iVar1 != 0) {

    FUN_0045fe40();

    return;

  }

  return;

}





// --- FUN_0046bba0 at 0x0046BBA0 (size: 36) ---


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



{

  *param_1 = &PTR_FUN_0079d700;

  FUN_00464e00();

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

    operator_delete(param_1);

  }

  return param_1;

}





// --- FUN_0046bbd0 at 0x0046BBD0 (size: 16) ---


void FUN_0046bbd0(void)



{

  FUN_00460270(9,&LAB_0046ba50);

  return;

}





// --- FUN_0046bcd0 at 0x0046BCD0 (size: 77) ---


bool FUN_0046bcd0(int *param_1)



{

  char cVar1;

  char cVar2;

  

  cVar1 = FUN_004625b0(param_1);

  FUN_00425ba0();

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

    return false;

  }

  cVar2 = FUN_00427240(0x10,param_1);

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

  return cVar2 != '\0' && cVar1 != '\0';

}





// --- FUN_0046bd80 at 0x0046BD80 (size: 22) ---


void FUN_0046bd80(undefined4 param_1)



{

  FUN_00462e60(param_1);

  FUN_00429a00();

  return;

}





// --- FUN_0046bda0 at 0x0046BDA0 (size: 69) ---


bool FUN_0046bda0(int *param_1)



{

  int iVar1;

  

  if (*param_1 != 0) {

    return false;

  }

  iVar1 = FUN_005df0f5(0x58);

  if (iVar1 != 0) {

    iVar1 = FUN_00696020();

    *param_1 = iVar1;

    return iVar1 != 0;

  }

  *param_1 = 0;

  return false;

}





// --- FUN_0046bdf0 at 0x0046BDF0 (size: 20) ---


void FUN_0046bdf0(void)



{

  FUN_004639a0();

  FUN_00452360();

  return;

}





// --- FUN_0046be10 at 0x0046BE10 (size: 35) ---


void FUN_0046be10(undefined4 param_1,undefined4 param_2)



{

  FUN_004523a0(param_1);

  FUN_00453770(param_2);

  return;

}





// --- FUN_0046be40 at 0x0046BE40 (size: 49) ---


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



{

  FUN_004544d0();

  FUN_00455650(param_1,param_2);

  FUN_00454560(0,param_3);

  return;

}





// --- FUN_0046be80 at 0x0046BE80 (size: 49) ---


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



{

  *param_1 = &PTR_FUN_0079d8c8;

  FUN_004551f0();

  FUN_00464e00();

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

    operator_delete(param_1);

  }

  return param_1;

}





// --- FUN_0046bec0 at 0x0046BEC0 (size: 16) ---


void FUN_0046bec0(void)



{

  FUN_00460270(0xd,&LAB_0046bd40);

  return;

}





// --- FUN_0046bed0 at 0x0046BED0 (size: 77) ---


bool FUN_0046bed0(int *param_1)



{

  char cVar1;

  char cVar2;

  

  cVar1 = FUN_004625b0(param_1);

  FUN_00425ba0();

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

    return false;

  }

  cVar2 = FUN_00427240(0x14,param_1);

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

  return cVar2 != '\0' && cVar1 != '\0';

}





// --- FUN_0046bf20 at 0x0046BF20 (size: 64) ---


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



{

  *param_1 = &PTR_FUN_0079da00;

  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_0046bf60 at 0x0046BF60 (size: 77) ---


bool FUN_0046bf60(int *param_1)



{

  char cVar1;

  char cVar2;

  

  cVar1 = FUN_004625b0(param_1);

  FUN_00425ba0();

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

    return false;

  }

  cVar2 = FUN_00427240(0xf,param_1);

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

  return cVar2 != '\0' && cVar1 != '\0';

}





// --- FUN_0046bfb0 at 0x0046BFB0 (size: 58) ---


void __fastcall FUN_0046bfb0(int *param_1)



{

  int iVar1;

  int iVar2;

  int *piVar3;

  

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

  param_1[2] = iVar1;

  if (iVar1 == 0) {

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

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

    do {

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

      param_1[1] = (int)piVar3;

      if (piVar3 == (int *)(iVar2 + iVar1 * 4)) {

        return;

      }

    } while (*piVar3 == 0);

    param_1[2] = *piVar3;

  }

  return;

}





// --- FUN_0046bff0 at 0x0046BFF0 (size: 275) ---


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



{

  int iVar1;

  int iVar2;

  int *piVar3;

  int *piVar4;

  int *piVar5;

  undefined4 *local_14;

  undefined1 local_c [12];

  

  if ((param_2 != *(int *)(param_1 + 0x6d8)) && (param_3 != *(int *)(param_1 + 0x6dc))) {

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

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

    piVar3 = (int *)FUN_0052dcf0(local_c);

    piVar5 = (int *)piVar3[2];

    iVar1 = *piVar3;

    local_14 = (undefined4 *)piVar3[1];

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

      do {

        iVar2 = *piVar5;

        param_2 = 0;

        param_3 = 0xb;

        if ((*(int *)(param_1 + 0x6dc) == iVar2) && (*(int *)(param_1 + 0x6d8) == piVar5[2])) {

          param_2 = 1;

          param_3 = 0xc;

        }

        piVar3 = (int *)FUN_00463c00(piVar5[2]);

        piVar4 = (int *)FUN_00463c00(iVar2);

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

          (**(code **)(*piVar3 + 0x18))(param_2);

        }

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

          (**(code **)(*piVar4 + 0x9c))(param_3);

        }

        piVar5 = (int *)piVar5[1];

      } while (piVar5 != (int *)0x0);

      do {

        local_14 = local_14 + 1;

        if (local_14 == (undefined4 *)(*(int *)(iVar1 + 0x60) + *(int *)(iVar1 + 0x68) * 4))

        goto LAB_0046c0f1;

        piVar5 = (int *)*local_14;

      } while (piVar5 == (int *)0x0);

    }

LAB_0046c0f1:

    FUN_00460410(0x2c,0,0);

  }

  return;

}





// --- FUN_0046c110 at 0x0046C110 (size: 129) ---


undefined4 __thiscall FUN_0046c110(int param_1,uint param_2)



{

  uint *puVar1;

  uint uVar2;

  

  puVar1 = *(uint **)(*(int *)(param_1 + 0x654) + (param_2 % *(uint *)(param_1 + 0x65c)) * 4);

  while( true ) {

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

      return 0;

    }

    if (*puVar1 == param_2) break;

    puVar1 = (uint *)puVar1[1];

  }

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

    return 0;

  }

  uVar2 = puVar1[2];

  puVar1 = *(uint **)(*(int *)(param_1 + 0x6c8) + (uVar2 % *(uint *)(param_1 + 0x6d0)) * 4);

  while( true ) {

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

      return 0;

    }

    if (*puVar1 == uVar2) break;

    puVar1 = (uint *)puVar1[1];

  }

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

    return 0;

  }

  if (puVar1[2] != param_2) {

    return 0;

  }

  FUN_0046bff0(uVar2,puVar1[2]);

  return 1;

}





// --- FUN_0046c1a0 at 0x0046C1A0 (size: 68) ---


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



{

  uint *puVar1;

  

  puVar1 = *(uint **)(*(int *)(param_1 + 0x6c8) + (param_2 % *(uint *)(param_1 + 0x6d0)) * 4);

  while( true ) {

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

      return 0;

    }

    if (*puVar1 == param_2) break;

    puVar1 = (uint *)puVar1[1];

  }

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

    return 0;

  }

  *param_3 = puVar1[2];

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

}





// --- FUN_0046c1f0 at 0x0046C1F0 (size: 143) ---


undefined4 * __thiscall FUN_0046c1f0(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_0079da00;

  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_0046c280 at 0x0046C280 (size: 229) ---


undefined4 __thiscall FUN_0046c280(int param_1,int param_2)



{

  int iVar1;

  uint *puVar2;

  int *piVar3;

  uint *puVar4;

  uint *puVar5;

  uint *puVar6;

  uint *puVar7;

  

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

    return 0;

  }

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

  puVar2 = (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(param_2);

      while (puVar2 != (uint *)0x0) {

        puVar6 = (uint *)puVar2[1];

        puVar7 = (uint *)(*(int *)(param_1 + 0x60) + (*puVar2 % *(uint *)(param_1 + 0x68)) * 4);

        puVar2[1] = *puVar7;

        *puVar7 = (uint)puVar2;

        if (puVar7 < *(uint **)(param_1 + 100)) {

          *(uint **)(param_1 + 100) = puVar7;

        }

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

        puVar2 = puVar6;

      }

      return 1;

    }

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

    while (piVar3 != (int *)(*(int *)(param_1 + 0x60) + *(int *)(param_1 + 0x68) * 4)) {

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

        puVar7 = *(uint **)(param_1 + 100);

        puVar6 = (uint *)*puVar7;

        goto LAB_0046c2ce;

      }

      piVar3 = *(int **)(param_1 + 100) + 1;

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

    }

    puVar7 = (uint *)0x0;

    puVar6 = (uint *)0x0;

LAB_0046c2ce:

    puVar5 = (uint *)*puVar7;

    if (puVar5 == puVar6) {

LAB_0046c2e1:

      *puVar7 = puVar5[1];

    }

    else {

      do {

        puVar4 = puVar5;

        puVar5 = (uint *)puVar4[1];

      } while (puVar5 != puVar6);

      if (puVar4 == (uint *)0x0) goto LAB_0046c2e1;

      puVar4[1] = puVar5[1];

    }

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

    puVar6[1] = (uint)puVar2;

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

    puVar2 = puVar6;

  } while( true );

}





// --- FUN_0046c370 at 0x0046C370 (size: 378) ---


void __thiscall FUN_0046c370(int *param_1,undefined4 *param_2)



{

  undefined4 *puVar1;

  undefined4 *puVar2;

  char cVar3;

  int iVar4;

  int *piVar5;

  uint uVar6;

  undefined1 local_c [12];

  

  puVar2 = param_2;

  if ((int *)param_2[1] == param_1) {

    if (param_2[2] == 0x18) {

      if (param_2[3] == 0) {

        iVar4 = FUN_0052dcf0(local_c);

        puVar1 = *(undefined4 **)(iVar4 + 8);

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

          do {

            piVar5 = (int *)FUN_00463c00(*puVar1);

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

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

            }

            FUN_0046bfb0();

          } while (puVar1 != (undefined4 *)0x0);

          FUN_00462420(puVar2);

          return;

        }

      }

      else {

        piVar5 = (int *)FUN_00463c00(param_1[0x1b6]);

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

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

          FUN_00462420(puVar2);

          return;

        }

      }

    }

  }

  else {

    piVar5 = (int *)(**(code **)(*(int *)param_2[1] + 0xa0))();

    if (piVar5 == param_1) {

      iVar4 = puVar2[2];

      if (iVar4 == 0x18) {

        cVar3 = FUN_004636c0(puVar2);

        if ((cVar3 != '\0') && (puVar2[1] != 0)) {

          if ((*(uint *)(puVar2[1] + 0xa4) >> 1 & 1) != 0) {

            param_2 = (undefined4 *)0x0;

            FUN_0046c1a0(*puVar2,&param_2);

            FUN_0046c110(param_2);

          }

          iVar4 = FUN_00463c00(param_1[0x1b6]);

          if (iVar4 == 0) {

            uVar6 = 0;

          }

          else {

            uVar6 = *(uint *)(iVar4 + 0xa4) >> 1 & 0xffffff01;

          }

          (**(code **)(*param_1 + 0x18))(uVar6);

        }

      }

      else if ((iVar4 == 0x19) || (iVar4 == 0x29)) {

        FUN_0046c110(*puVar2);

        FUN_00462420(puVar2);

        return;

      }

    }

  }

  FUN_00462420(puVar2);

  return;

}





// --- FUN_0046c4f0 at 0x0046C4F0 (size: 82) ---


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



{

  *param_1 = &PTR_FUN_0079da04;

  FUN_005870f0();

  param_1[1] = &PTR_FUN_0079da00;

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

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

  }

  param_1[0x19] = 0;

  param_1[0x1a] = 0;

  param_1[0x1b] = 0;

  param_1[0x1c] = 0;

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

    operator_delete(param_1);

  }

  return param_1;

}





// --- FUN_0046c550 at 0x0046C550 (size: 92) ---


undefined4 * __thiscall FUN_0046c550(undefined4 *param_1,undefined4 param_2,undefined4 param_3)



{

  FUN_00464900(param_2,param_3);

  *param_1 = &PTR_FUN_0079da08;

  param_1[0x17c] = &PTR_FUN_0079da04;

  FUN_0046c1f0(0x17);

  param_1[0x199] = &PTR_FUN_0079da04;

  FUN_0046c1f0(0x17);

  param_1[0x1b6] = 0;

  param_1[0x1b7] = 0;

  return param_1;

}





// --- FUN_0046c5d0 at 0x0046C5D0 (size: 177) ---


void __fastcall FUN_0046c5d0(undefined4 *param_1)



{

  *param_1 = &PTR_FUN_0079da08;

  FUN_005870f0();

  FUN_005870f0();

  param_1[0x1b7] = 0;

  param_1[0x1b6] = 0;

  param_1[0x199] = &PTR_FUN_0079da04;

  FUN_005870f0();

  param_1[0x19a] = &PTR_FUN_0079da00;

  if ((undefined4 *)param_1[0x1b2] != param_1 + 0x19b) {

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

  }

  param_1[0x1b2] = 0;

  param_1[0x1b3] = 0;

  param_1[0x1b4] = 0;

  param_1[0x1b5] = 0;

  param_1[0x17c] = &PTR_FUN_0079da04;

  FUN_005870f0();

  param_1[0x17d] = &PTR_FUN_0079da00;

  if ((undefined4 *)param_1[0x195] != param_1 + 0x17e) {

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

  }

  param_1[0x195] = 0;

  param_1[0x196] = 0;

  param_1[0x197] = 0;

  param_1[0x198] = 0;

  FUN_00464e00();

  return;

}





// --- FUN_0046c6c0 at 0x0046C6C0 (size: 943) ---


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



void __fastcall FUN_0046c6c0(int *param_1)



{

  char cVar1;

  char cVar2;

  int iVar3;

  int *piVar4;

  uint uVar5;

  int iStack_48;

  int iStack_44;

  uint uStack_40;

  undefined4 uStack_3c;

  undefined4 *puStack_38;

  int *local_34;

  undefined4 *puStack_30;

  int *piStack_2c;

  undefined4 *puStack_28;

  int *piStack_24;

  undefined4 *puStack_20;

  int *piStack_1c;

  undefined4 local_18;

  int *local_14;

  

  FUN_005870f0();

  FUN_005870f0();

  param_1[0x1b7] = 0;

  param_1[0x1b6] = 0;

  local_34 = (int *)0x0;

  local_18 = 0;

  local_14 = (int *)0x0;

  cVar1 = (**(code **)(*param_1 + 0xd0))(0x2e,&local_18);

  if ((((cVar1 != '\0') && (uStack_40 = 0, piStack_1c != (int *)0x0)) &&

      (cVar1 = (**(code **)(*piStack_1c + 0xf0))(&uStack_40), cVar1 != '\0')) &&

     (uVar5 = 0, uStack_40 != 0)) {

    do {

      puStack_38 = (undefined4 *)0x0;

      local_34 = (int *)0x0;

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

        cVar1 = (**(code **)(*piStack_1c + 0xf4))(uVar5,&puStack_38);

        if ((cVar1 != '\0') && (iVar3 = FUN_00429a00(), iVar3 == 0x2f)) {

          puStack_28 = (undefined4 *)0x0;

          piStack_24 = (int *)0x0;

          puStack_30 = (undefined4 *)0x0;

          piStack_2c = (int *)0x0;

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

            cVar1 = (**(code **)(*local_34 + 0x118))(0x30,&puStack_28);

            if (((cVar1 != '\0') && (local_34 != (int *)0x0)) &&

               (cVar1 = (**(code **)(*local_34 + 0x118))(0x31,&puStack_30), cVar1 != '\0')) {

              iStack_48 = 0;

              iStack_44 = 0;

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

                cVar1 = '\0';

              }

              else {

                cVar1 = (**(code **)(*piStack_24 + 0xa8))(&iStack_48);

              }

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

                cVar2 = '\0';

              }

              else {

                cVar2 = (**(code **)(*piStack_2c + 0xa8))(&iStack_44);

              }

              if ((cVar1 == '\0') || (cVar2 == '\0')) {

                FUN_004234d0();

                FUN_004234d0();

                FUN_004234d0();

                goto LAB_0046c9b6;

              }

              cVar1 = FUN_006891f0(&iStack_48,&iStack_44);

              if (((cVar1 != '\0') && (cVar1 = FUN_006891f0(&iStack_44,&iStack_48), cVar1 != '\0'))

                 && (iStack_48 != iStack_44)) {

                local_18 = 0;

                local_14 = (int *)0x0;

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

                    (cVar1 = (**(code **)(*local_34 + 0x118))(0x32,&local_18), cVar1 != '\0')) &&

                   (local_14 != (int *)0x0)) {

                  (**(code **)(*local_14 + 0x70))(&stack0xffffffb7);

                }

                piVar4 = (int *)FUN_00463c00(iStack_48);

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

                  FUN_004234d0();

                  FUN_004234d0();

                  FUN_004234d0();

                  FUN_004234d0();

                  FUN_004234d0();

                  return;

                }

                (**(code **)(*piVar4 + 0x110))(1);

                FUN_004234d0();

              }

            }

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

              iVar3 = puStack_30[1];

              puStack_30[1] = iVar3 + -1;

              if (iVar3 + -1 == 0) {

                (**(code **)*puStack_30)(1);

              }

              puStack_30 = (undefined4 *)0x0;

            }

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

              iVar3 = piStack_2c[1];

              piStack_2c[1] = iVar3 + -1;

              if (iVar3 + -1 == 0) {

                (**(code **)*piStack_2c)(1);

              }

              piStack_2c = (int *)0x0;

            }

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

              iVar3 = puStack_28[1];

              puStack_28[1] = iVar3 + -1;

              if (iVar3 + -1 == 0) {

                (**(code **)*puStack_28)(1);

              }

              puStack_28 = (undefined4 *)0x0;

            }

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

              iVar3 = piStack_24[1];

              piStack_24[1] = iVar3 + -1;

              if (iVar3 + -1 == 0) {

                (**(code **)*piStack_24)(1);

              }

              piStack_24 = (int *)0x0;

            }

          }

        }

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

          iVar3 = puStack_38[1];

          puStack_38[1] = iVar3 + -1;

          if (iVar3 + -1 == 0) {

            (**(code **)*puStack_38)(1);

          }

          puStack_38 = (undefined4 *)0x0;

        }

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

          iVar3 = local_34[1];

          local_34[1] = iVar3 + -1;

          if (iVar3 + -1 == 0) {

            (**(code **)*local_34)(1);

          }

          local_34 = (int *)0x0;

        }

      }

LAB_0046c9b6:

      uVar5 = uVar5 + 1;

    } while (uVar5 < uStack_40);

  }

  FUN_0046bff0(uStack_3c,0);

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

    iVar3 = puStack_20[1];

    puStack_20[1] = iVar3 + -1;

    if (iVar3 + -1 == 0) {

      (**(code **)*puStack_20)(1);

    }

    puStack_20 = (undefined4 *)0x0;

  }

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

     (iVar3 = piStack_1c[1], piStack_1c[1] = iVar3 + -1, iVar3 + -1 == 0)) {

    (**(code **)*piStack_1c)(1);

  }

  return;

}





// --- FUN_0046ca70 at 0x0046CA70 (size: 30) ---


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



{

  FUN_0046c5d0();

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

    operator_delete(param_1);

  }

  return param_1;

}





// --- FUN_0046ca90 at 0x0046CA90 (size: 16) ---


void FUN_0046ca90(void)



{

  FUN_00460270(8,&LAB_0046c690);

  return;

}





// --- FUN_0046cb40 at 0x0046CB40 (size: 89) ---


void __thiscall FUN_0046cb40(int *param_1,int param_2)



{

  int iVar1;

  

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

    iVar1 = (**(code **)(*param_1 + 0xa0))();

    if (((iVar1 != 0) && ((*(uint *)(iVar1 + 0x554) >> 0x13 & 1) == 0)) &&

       ((*(uint *)(iVar1 + 0x554) >> 0x12 & 1) == 0)) {

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

      FUN_0045fe90(*(undefined4 *)(param_2 + 0x14),*(undefined4 *)(param_2 + 0x18));

      (**(code **)(*param_1 + 0x9c))(3);

    }

  }

  return;

}





// --- FUN_0046cba0 at 0x0046CBA0 (size: 67) ---


void __thiscall FUN_0046cba0(int *param_1,int param_2)



{

  int iVar1;

  

  if (((char)param_1[0x17c] != '\0') && (*(int *)(param_2 + 0xc) == 7)) {

    (**(code **)(*param_1 + 0x9c))(1);

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

    iVar1 = (**(code **)(*param_1 + 0xa0))();

    if (iVar1 != 0) {

      FUN_0045ff00();

    }

  }

  return;

}





// --- FUN_0046cbf0 at 0x0046CBF0 (size: 36) ---


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



{

  *param_1 = &PTR_FUN_0079db40;

  FUN_00464e00();

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

    operator_delete(param_1);

  }

  return param_1;

}





// --- FUN_0046cc20 at 0x0046CC20 (size: 16) ---


void FUN_0046cc20(void)



{

  FUN_00460270(2,&LAB_0046cb00);

  return;

}





// --- FUN_0046cd20 at 0x0046CD20 (size: 77) ---


bool FUN_0046cd20(int *param_1)



{

  char cVar1;

  char cVar2;

  

  cVar1 = FUN_004625b0(param_1);

  FUN_00425ba0();

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

    return false;

  }

  cVar2 = FUN_00427240(7,param_1);

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

  return cVar2 != '\0' && cVar1 != '\0';

}





// --- FUN_0046cd70 at 0x0046CD70 (size: 74) ---


undefined4 * __thiscall FUN_0046cd70(undefined4 *param_1,undefined4 param_2,undefined4 param_3)



{

  FUN_00471f10(param_2,param_3);

  param_1[0x1c8] = 0;

  param_1[0x1c9] = 0;

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

  param_1[0x1cb] = 0;

  param_1[0x1cc] = 0;

  *param_1 = &PTR_FUN_0079dc80;

  param_1[0x182] = &PTR_FUN_0079d180;

  return param_1;

}





// --- FUN_0046ce20 at 0x0046CE20 (size: 16) ---


void __fastcall FUN_0046ce20(int param_1)



{

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

    FUN_0046e460();

    return;

  }

  return;

}





// --- FUN_0046ce30 at 0x0046CE30 (size: 20) ---


undefined4 __fastcall FUN_0046ce30(int param_1)



{

  undefined4 uVar1;

  

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

    uVar1 = FUN_0046dc50();

    return uVar1;

  }

  return 0;

}





// --- FUN_0046ce50 at 0x0046CE50 (size: 20) ---


undefined4 __fastcall FUN_0046ce50(int param_1)



{

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

    return *(undefined4 *)(*(int *)(param_1 + 0x724) + 0x614);

  }

  return 0;

}





// --- FUN_0046ce70 at 0x0046CE70 (size: 58) ---


undefined4 __thiscall FUN_0046ce70(int param_1,int *param_2)



{

  undefined4 uVar1;

  

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

    (**(code **)(*param_2 + 0x110))(1);

    uVar1 = FUN_0046eb20(param_2,param_2);

    return uVar1;

  }

  return 0;

}





// --- FUN_0046ceb0 at 0x0046CEB0 (size: 17) ---


void __fastcall FUN_0046ceb0(int param_1)



{

  FUN_00460820(0xe,*(undefined1 *)(param_1 + 0x728));

  return;

}





// --- FUN_0046ced0 at 0x0046CED0 (size: 129) ---


void __fastcall FUN_0046ced0(int param_1)



{

  int iVar1;

  int iVar2;

  int iVar3;

  

  if ((*(int *)(param_1 + 0x724) != 0) && (*(int *)(param_1 + 0x720) != 0)) {

    iVar2 = FUN_0069fe60();

    iVar3 = FUN_0069fe70();

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

    if ((*(int *)(iVar1 + 0x2fc) == 1) && (*(int *)(iVar1 + 0x304) == 1)) {

      iVar2 = *(int *)(iVar1 + 0x600) + *(int *)(param_1 + 0x72c);

    }

    if ((*(int *)(iVar1 + 0x300) == 1) && (*(int *)(iVar1 + 0x308) == 1)) {

      iVar3 = *(int *)(iVar1 + 0x604) + *(int *)(param_1 + 0x730);

    }

    (**(code **)(**(int **)(param_1 + 0x720) + 0x30))(iVar2,iVar3);

  }

  return;

}





// --- FUN_0046cf60 at 0x0046CF60 (size: 49) ---


uint __fastcall FUN_0046cf60(int param_1)



{

  uint uVar1;

  int *piVar2;

  

  uVar1 = 0;

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

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

    do {

      if (*piVar2 == *(int *)(param_1 + 0x614)) {

        return uVar1;

      }

      uVar1 = uVar1 + 1;

      piVar2 = piVar2 + 1;

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

  }

  return 0xffffffff;

}





// --- FUN_0046cfa0 at 0x0046CFA0 (size: 16) ---


void FUN_0046cfa0(void)



{

  FUN_00460270(6,&LAB_0046cdf0);

  return;

}





// --- FUN_0046cfb0 at 0x0046CFB0 (size: 20) ---


undefined4 __fastcall FUN_0046cfb0(int param_1)



{

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

    return *(undefined4 *)(*(int *)(param_1 + 0x724) + 0x610);

  }

  return 0;

}





// --- FUN_0046cfd0 at 0x0046CFD0 (size: 56) ---


uint __fastcall FUN_0046cfd0(int param_1)



{

  int iVar1;

  uint uVar2;

  int *piVar3;

  

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

  if (iVar1 == 0) {

    return 0xffffffff;

  }

  uVar2 = 0;

  if (*(uint *)(iVar1 + 0x610) != 0) {

    piVar3 = *(int **)(iVar1 + 0x608);

    do {

      if (*piVar3 == *(int *)(iVar1 + 0x614)) {

        return uVar2;

      }

      uVar2 = uVar2 + 1;

      piVar3 = piVar3 + 1;

    } while (uVar2 < *(uint *)(iVar1 + 0x610));

  }

  return 0xffffffff;

}





// --- FUN_0046d010 at 0x0046D010 (size: 239) ---


void __fastcall FUN_0046d010(int param_1)



{

  int iVar1;

  int iVar2;

  int iVar3;

  undefined4 uStack_4;

  

  if ((((*(char *)(param_1 + 0x728) == '\0') && (*(int *)(param_1 + 0x724) != 0)) &&

      (*(int *)(*(int *)(param_1 + 0x724) + 0x610) != 0)) && (*(int *)(param_1 + 0x720) != 0)) {

    uStack_4 = param_1;

    FUN_00460cc0(5,(int)&uStack_4 + 3);

    FUN_00460cc0(3,(int)&uStack_4 + 2);

    iVar1 = FUN_0069fe00();

    if (uStack_4._2_1_ != '\0') {

      iVar2 = FUN_0069fe60();

      iVar3 = FUN_0069fe60();

      iVar1 = iVar1 - (iVar3 - iVar2) / 2;

    }

    if (uStack_4._3_1_ == '\0') {

      iVar2 = FUN_006a01e0();

    }

    else {

      iVar2 = FUN_0069fe30();

      iVar3 = FUN_0069fe70();

      iVar2 = iVar2 - iVar3;

    }

    (**(code **)(**(int **)(param_1 + 0x720) + 0x2c))(iVar1,iVar2);

    (**(code **)(**(int **)(param_1 + 0x720) + 0x18))(1);

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

    FUN_00460820(0xe,1);

    FUN_00460410(8,0,0);

  }

  return;

}





// --- FUN_0046d100 at 0x0046D100 (size: 63) ---


void __fastcall FUN_0046d100(int param_1)



{

  if ((*(char *)(param_1 + 0x728) != '\0') && (*(int **)(param_1 + 0x720) != (int *)0x0)) {

    (**(code **)(**(int **)(param_1 + 0x720) + 0x18))(0);

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

    FUN_00460820(0xe,0);

    FUN_00460410(9,0,0);

  }

  return;

}





// --- FUN_0046d140 at 0x0046D140 (size: 218) ---


void __thiscall FUN_0046d140(int param_1,char param_2)



{

  int *piVar1;

  int iVar2;

  undefined4 uVar3;

  int local_8;

  undefined1 auStack_4 [4];

  

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

    FUN_00460990(8,&local_8);

    if (((local_8 != 0) && (piVar1 = (int *)FUN_00463c00(local_8), piVar1 != (int *)0x0)) &&

       (iVar2 = (**(code **)(*piVar1 + 0x94))(0xc), iVar2 != 0)) {

      if ((*(int *)(param_1 + 0x724) == 0) ||

         (piVar1 = *(int **)(*(int *)(param_1 + 0x724) + 0x614), piVar1 == (int *)0x0)) {

        FUN_00467ae0();

      }

      else {

        iVar2 = (**(code **)(*piVar1 + 0x94))(0xc);

        if (iVar2 != 0) {

          uVar3 = FUN_004668a0(auStack_4);

          FUN_0046a740(uVar3);

          FUN_004011b0();

        }

      }

    }

    if (param_2 != '\0') {

      if ((*(int *)(param_1 + 0x724) != 0) &&

         (iVar2 = *(int *)(*(int *)(param_1 + 0x724) + 0x614), iVar2 != 0)) {

        FUN_00460410(7,*(undefined4 *)(iVar2 + 0x2e4),iVar2);

        return;

      }

      FUN_00460410(7,0,0);

    }

  }

  return;

}





// --- FUN_0046d220 at 0x0046D220 (size: 126) ---


void __fastcall FUN_0046d220(undefined4 *param_1)



{

  *param_1 = &PTR_FUN_0079dc80;

  param_1[0x182] = &PTR_FUN_0079d180;

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

    FUN_00464b00(param_1);

  }

  if ((*(char *)(param_1 + 0x1ca) != '\0') && ((int *)param_1[0x1c8] != (int *)0x0)) {

    (**(code **)(*(int *)param_1[0x1c8] + 0x18))(0);

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

    FUN_00460820(0xe,0);

    FUN_00460410(9,0,0);

  }

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

    FUN_00460250();

    param_1[0x1c8] = 0;

  }

  FUN_00471f80();

  return;

}





// --- FUN_0046d2a0 at 0x0046D2A0 (size: 77) ---


bool FUN_0046d2a0(int *param_1)



{

  char cVar1;

  char cVar2;

  

  cVar1 = FUN_004625b0(param_1);

  FUN_00425ba0();

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

    return false;

  }

  cVar2 = FUN_00427240(0xd,param_1);

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

  return cVar2 != '\0' && cVar1 != '\0';

}





// --- FUN_0046d2f0 at 0x0046D2F0 (size: 292) ---


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

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

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

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

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

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

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

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

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



undefined4 __fastcall FUN_0046d2f0(int param_1)



{

  char cVar1;

  undefined4 local_8;

  undefined1 local_4 [4];

  

  FUN_00460990(9,local_4);

  if (DAT_0083e03c != 0) {

    local_8 = DAT_0083e534;

    cVar1 = FUN_00460d80(10,&local_8);

    if (cVar1 != '\0') {

      FUN_00459a40(local_8);

    }

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

      FUN_00459a40(*(undefined4 *)(*(int *)(param_1 + 0x238) + 0x28));

    }

  }

  return 0;

}





// --- FUN_0046d420 at 0x0046D420 (size: 134) ---


undefined4 __thiscall FUN_0046d420(int param_1,undefined4 param_2,uint param_3)



{

  int iVar1;

  uint uVar2;

  undefined4 uVar3;

  int *piVar4;

  

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

  if (iVar1 == 0) {

    uVar2 = 0xffffffff;

  }

  else {

    uVar2 = 0;

    if (*(uint *)(iVar1 + 0x610) != 0) {

      piVar4 = *(int **)(iVar1 + 0x608);

      do {

        if (*piVar4 == *(int *)(iVar1 + 0x614)) goto LAB_0046d465;

        uVar2 = uVar2 + 1;

        piVar4 = piVar4 + 1;

      } while (uVar2 < *(uint *)(iVar1 + 0x610));

    }

    uVar2 = 0xffffffff;

  }

LAB_0046d465:

  if ((int)param_3 < *(int *)(iVar1 + 0x610)) {

    FUN_0046e430(param_3);

  }

  uVar3 = FUN_0046d2f0(param_2,param_3);

  if (uVar2 == param_3) {

    FUN_0046dc70(uVar3,1);

  }

  return uVar3;

}





// --- FUN_0046d4b0 at 0x0046D4B0 (size: 42) ---


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



{

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

    FUN_0046dc70(param_2,param_3);

    FUN_0046d140(param_3);

  }

  return;

}





// --- FUN_0046d510 at 0x0046D510 (size: 78) ---


undefined4 __fastcall FUN_0046d510(int param_1)



{

  char extraout_AL;

  undefined3 extraout_var;

  undefined3 extraout_var_00;

  undefined3 uVar1;

  

  FUN_00461e30();

  uVar1 = extraout_var;

  if (((extraout_AL != '\0') && (*(char *)(param_1 + 0x728) != '\0')) &&

     (*(int **)(param_1 + 0x720) != (int *)0x0)) {

    (**(code **)(**(int **)(param_1 + 0x720) + 0x18))(0);

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

    FUN_00460820(0xe,0);

    FUN_00460410(9,0,0);

    uVar1 = extraout_var_00;

  }

  return CONCAT31(uVar1,extraout_AL);

}





// --- FUN_0046d560 at 0x0046D560 (size: 362) ---


undefined4 __thiscall FUN_0046d560(int param_1,int param_2)



{

  int *piVar1;

  int iVar2;

  int iVar3;

  undefined4 uVar4;

  

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

  if (piVar1 == *(int **)(param_1 + 0x720)) {

    if (((*(int *)(param_2 + 8) == 0x2a) && (*(char *)(param_1 + 0x728) != '\0')) &&

       ((*(byte *)(param_1 + 0xa4) & 1) == 0)) {

      FUN_0046d100();

      return 2;

    }

  }

  else {

    if (piVar1 != *(int **)(param_1 + 0x724)) {

      iVar2 = (**(code **)(*piVar1 + 0xa0))();

      if (iVar2 == *(int *)(param_1 + 0x724)) {

        if (*(int *)(param_2 + 8) == 0x1b) {

          iVar2 = (*(int **)(param_2 + 4))[0x100];

          iVar3 = iVar2;

          if (iVar2 == 0) {

            iVar3 = 1;

          }

          switch(iVar3) {

          case 1:

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

              iVar3 = 2;

            }

            break;

          case 2:

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

              iVar3 = 1;

            }

            break;

          case 6:

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

              iVar3 = 7;

            }

            break;

          case 7:

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

              iVar3 = 6;

            }

          }

          if (iVar3 != iVar2) {

            (**(code **)(**(int **)(param_2 + 4) + 0x9c))(iVar3);

          }

        }

        return 2;

      }

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

        if (*(int *)(param_2 + 8) == 1) {

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

            FUN_0046d100();

            return 2;

          }

          FUN_0046d010();

          return 2;

        }

        if (*(int *)(param_2 + 8) == 0x1b) {

          FUN_0046ceb0();

          return 2;

        }

      }

      uVar4 = FUN_004725d0(param_2);

      return uVar4;

    }

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

    if (iVar2 == 4) {

      FUN_0046d140(1);

    }

    else {

      if (iVar2 == 0x32) {

        FUN_0046ced0();

        return 2;

      }

      if (iVar2 != 0x43) {

        return 2;

      }

    }

    FUN_0046d100();

  }

  return 2;

}





// --- FUN_0046d6f0 at 0x0046D6F0 (size: 231) ---


void __fastcall FUN_0046d6f0(int param_1)



{

  int *piVar1;

  char cVar2;

  int *piVar3;

  int *local_8;

  undefined4 local_4;

  

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

    FUN_00460250();

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

  }

  if (DAT_0083e03c != 0) {

    local_8 = (int *)0x0;

    local_4 = DAT_0083e534;

    cVar2 = FUN_00460d80(7,&local_4);

    if (((cVar2 != '\0') && (FUN_00459a40(local_4), local_8 != (int *)0x0)) ||

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

        (FUN_00459a40(*(undefined4 *)(*(int *)(param_1 + 0x238) + 0x28)), local_8 != (int *)0x0))))

    {

      piVar1 = local_8;

      FUN_00460990(6,&local_8);

      piVar3 = (int *)FUN_0045d880(piVar1,local_8);

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

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

        FUN_00460820(0x33,1);

        FUN_00460820(0x34,1);

        *(int **)(param_1 + 0x720) = piVar3;

        FUN_00464ad0(param_1);

      }

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

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

      }

    }

  }

  return;

}





// --- FUN_0046d7e0 at 0x0046D7E0 (size: 30) ---


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



{

  FUN_0046d220();

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

    operator_delete(param_1);

  }

  return param_1;

}





// --- FUN_0046d800 at 0x0046D800 (size: 26) ---


void __thiscall FUN_0046d800(int param_1,undefined4 param_2)



{

  FUN_0046d2f0(param_2,*(undefined4 *)(*(int *)(param_1 + 0x724) + 0x610));

  return;

}





// --- FUN_0046d930 at 0x0046D930 (size: 22) ---


void __thiscall FUN_0046d930(int param_1,undefined4 param_2)



{

  FUN_00474480(*(undefined4 *)(param_1 + 0x5f8),param_2,0);

  return;

}





// --- FUN_0046d950 at 0x0046D950 (size: 22) ---


void __thiscall FUN_0046d950(int param_1,undefined4 param_2)



{

  FUN_00474480(param_2,*(undefined4 *)(param_1 + 0x5fc),0);

  return;

}





// --- FUN_0046d970 at 0x0046D970 (size: 38) ---


void __thiscall FUN_0046d970(int param_1,char param_2)



{

  if (param_2 != '\0') {

    *(uint *)(param_1 + 0x660) = *(uint *)(param_1 + 0x660) | 1;

    return;

  }

  *(uint *)(param_1 + 0x660) = *(uint *)(param_1 + 0x660) & 0xfffffffe;

  return;

}





// --- FUN_0046d9a0 at 0x0046D9A0 (size: 38) ---


void __thiscall FUN_0046d9a0(int param_1,char param_2)



{

  if (param_2 != '\0') {

    *(uint *)(param_1 + 0x660) = *(uint *)(param_1 + 0x660) | 2;

    return;

  }

  *(uint *)(param_1 + 0x660) = *(uint *)(param_1 + 0x660) & 0xfffffffd;

  return;

}





// --- FUN_0046d9d0 at 0x0046D9D0 (size: 38) ---


void __thiscall FUN_0046d9d0(int param_1,char param_2)



{

  if (param_2 != '\0') {

    *(uint *)(param_1 + 0x660) = *(uint *)(param_1 + 0x660) | 4;

    return;

  }

  *(uint *)(param_1 + 0x660) = *(uint *)(param_1 + 0x660) & 0xfffffffb;

  return;

}





// --- FUN_0046da00 at 0x0046DA00 (size: 38) ---


void __thiscall FUN_0046da00(int param_1,char param_2)



{

  if (param_2 != '\0') {

    *(uint *)(param_1 + 0x660) = *(uint *)(param_1 + 0x660) | 8;

    return;

  }

  *(uint *)(param_1 + 0x660) = *(uint *)(param_1 + 0x660) & 0xfffffff7;

  return;

}





// --- FUN_0046da30 at 0x0046DA30 (size: 38) ---


void __thiscall FUN_0046da30(int param_1,char param_2)



{

  if (param_2 != '\0') {

    *(uint *)(param_1 + 0x660) = *(uint *)(param_1 + 0x660) | 0x20;

    return;

  }

  *(uint *)(param_1 + 0x660) = *(uint *)(param_1 + 0x660) & 0xffffffdf;

  return;

}





// --- FUN_0046da60 at 0x0046DA60 (size: 230) ---


void __thiscall FUN_0046da60(int param_1,int param_2)



{

  int iVar1;

  undefined4 uVar2;

  

  iVar1 = param_2;

  FUN_004749f0(param_2);

  uVar2 = FUN_00429a00();

  switch(uVar2) {

  case 0x59:

    if (*(int **)(iVar1 + 4) != (int *)0x0) {

      (**(code **)(**(int **)(iVar1 + 4) + 0x70))(&param_2);

    }

    FUN_0046d9a0(param_2);

    return;

  case 0x5a:

    if (*(int **)(iVar1 + 4) != (int *)0x0) {

      (**(code **)(**(int **)(iVar1 + 4) + 0x70))(&param_2);

    }

    FUN_0046da00(param_2);

    return;

  case 0x5b:

    if (*(int **)(iVar1 + 4) != (int *)0x0) {

      (**(code **)(**(int **)(iVar1 + 4) + 0x70))(&param_2);

    }

    FUN_0046d9d0(param_2);

    return;

  case 0x5c:

    if (*(int **)(iVar1 + 4) != (int *)0x0) {

      (**(code **)(**(int **)(iVar1 + 4) + 0x70))(&param_2);

    }

    FUN_0046d970(param_2);

switchD_0046da7d_caseD_5f:

    *(uint *)(param_1 + 0x660) = *(uint *)(param_1 + 0x660) | 0x200;

    FUN_006a0430();

    return;

  default:

    return;

  case 0x5f:

    goto switchD_0046da7d_caseD_5f;

  case 0x61:

    if (*(int **)(iVar1 + 4) != (int *)0x0) {

      (**(code **)(**(int **)(iVar1 + 4) + 0x70))(&param_2);

    }

    FUN_0046da30(param_2);

    return;

  }

}





// --- FUN_0046db70 at 0x0046DB70 (size: 90) ---


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



{

  int iVar1;

  int iVar2;

  int iVar3;

  

  iVar1 = FUN_0069fe60();

  iVar2 = FUN_0069fe70();

  FUN_00474a80(param_2,param_3);

  iVar3 = FUN_0069fe60();

  if ((iVar1 == iVar3) && (iVar1 = FUN_0069fe70(), iVar2 == iVar1)) {

    return;

  }

  *(uint *)(param_1 + 0x660) = *(uint *)(param_1 + 0x660) | 0x200;

  FUN_006a0430();

  return;

}





// --- FUN_0046dbf0 at 0x0046DBF0 (size: 89) ---


int __thiscall FUN_0046dbf0(int *param_1,char param_2,int param_3)



{

  int iVar1;

  int *piVar2;

  

  if ((param_1[0x198] & 0x200U) != 0) {

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

  }

  if (param_3 == -1) {

    if (param_2 != '\0') {

      param_3 = param_1[0x188];

      goto LAB_0046dc1d;

    }

    param_3 = param_1[0x189];

  }

  else {

LAB_0046dc1d:

    piVar2 = param_1 + 0x18d;

    if (param_2 != '\0') goto LAB_0046dc2d;

  }

  piVar2 = param_1 + 0x18a;

LAB_0046dc2d:

  iVar1 = 0;

  if (0 < param_3) {

    piVar2 = (int *)*piVar2;

    do {

      iVar1 = iVar1 + *piVar2;

      piVar2 = piVar2 + 1;

      param_3 = param_3 + -1;

    } while (param_3 != 0);

  }

  return iVar1;

}





// --- FUN_0046dc50 at 0x0046DC50 (size: 29) ---


undefined4 __thiscall FUN_0046dc50(int param_1,uint param_2)



{

  if (param_2 < *(uint *)(param_1 + 0x610)) {

    return *(undefined4 *)(*(int *)(param_1 + 0x608) + param_2 * 4);

  }

  return 0;

}





// --- FUN_0046dc70 at 0x0046DC70 (size: 234) ---


void __thiscall FUN_0046dc70(int param_1,int *param_2,char param_3)



{

  int *piVar1;

  uint uVar2;

  int *piVar3;

  

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

  if (piVar1 == param_2) {

    if (param_3 != '\0') {

      FUN_00460410(0x43,piVar1,0);

      return;

    }

  }

  else {

    uVar2 = 0;

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

      piVar3 = *(int **)(param_1 + 0x608);

      do {

        if ((int *)*piVar3 == param_2) {

          if (uVar2 == 0xffffffff) goto LAB_0046dcc5;

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

          goto LAB_0046dccf;

        }

        uVar2 = uVar2 + 1;

        piVar3 = piVar3 + 1;

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

    }

    uVar2 = 0xffffffff;

LAB_0046dcc5:

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

LAB_0046dccf:

    if ((*(byte *)(param_1 + 0x660) & 0x20) != 0) {

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

        FUN_00460990(0x5d,&param_2);

        (**(code **)(*piVar1 + 0x9c))(param_2);

      }

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

        FUN_00460990(0x5e,&param_2);

        (**(code **)(**(int **)(param_1 + 0x614) + 0x9c))(param_2);

      }

    }

    if (param_3 != '\0') {

      FUN_00460410(4,uVar2,*(undefined4 *)(param_1 + 0x614));

    }

  }

  return;

}





// --- FUN_0046dd60 at 0x0046DD60 (size: 277) ---


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



{

  uint uVar1;

  uint uVar2;

  int iVar3;

  int *piVar4;

  int iVar5;

  int iVar6;

  

  uVar1 = param_1[0x184];

  if (((uVar1 == 0) || ((int)param_2 < 0)) || (uVar1 = FUN_0069fe60(), (int)uVar1 <= (int)param_2))

  {

    return uVar1 & 0xffffff00;

  }

  if ((-1 < (int)param_3) && (uVar1 = FUN_0069fe70(), (int)param_3 < (int)uVar1)) {

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

    iVar6 = param_2 + param_1[0x17e];

    iVar5 = param_3 + param_1[0x17f];

    iVar3 = 0;

    uVar2 = 0;

    param_2 = 0;

    param_3 = 0;

    uVar1 = param_2;

    if (param_1[399] != 0) {

      piVar4 = (int *)param_1[0x18d];

      do {

        iVar3 = iVar3 + *piVar4;

        uVar1 = uVar2;

        if (iVar6 <= iVar3) break;

        uVar2 = uVar2 + 1;

        piVar4 = piVar4 + 1;

        uVar1 = param_2;

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

    }

    param_2 = uVar1;

    iVar3 = 0;

    uVar2 = 0;

    uVar1 = param_3;

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

      piVar4 = (int *)param_1[0x18a];

      do {

        iVar3 = iVar3 + *piVar4;

        uVar1 = uVar2;

        if (iVar5 <= iVar3) break;

        uVar2 = uVar2 + 1;

        piVar4 = piVar4 + 1;

        uVar1 = param_3;

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

    }

    param_3 = uVar1;

    if ((*(byte *)(param_1 + 0x198) & 1) == 0) {

      iVar3 = param_1[0x189] * param_2;

      param_2 = param_3;

    }

    else {

      iVar3 = param_1[0x188] * param_3;

    }

    uVar1 = iVar3 + param_2;

    if (uVar1 < (uint)param_1[0x184]) {

      *param_4 = uVar1;

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

    }

  }

  return uVar1 & 0xffffff00;

}





// --- FUN_0046de80 at 0x0046DE80 (size: 143) ---


int * __thiscall FUN_0046de80(int param_1,uint param_2)



{

  int *piVar1;

  

  if ((param_2 < *(uint *)(param_1 + 0x610)) &&

     (piVar1 = *(int **)(*(int *)(param_1 + 0x608) + param_2 * 4), piVar1 != (int *)0x0)) {

    FUN_00459590(param_2);

    *(uint *)(param_1 + 0x660) = *(uint *)(param_1 + 0x660) | 0x200;

    FUN_006a0430();

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

    if (piVar1 == *(int **)(param_1 + 0x614)) {

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

    }

    if (piVar1 == *(int **)(param_1 + 0x618)) {

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

    }

    if (piVar1 == *(int **)(param_1 + 0x1a0)) {

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

    }

    return piVar1;

  }

  return (int *)0x0;

}





// --- FUN_0046df10 at 0x0046DF10 (size: 54) ---


void __fastcall FUN_0046df10(int param_1)



{

  char cVar1;

  

  if (((*(byte *)(param_1 + 0x660) & 0x40) == 0) && (DAT_00837ff4 != 0)) {

    cVar1 = FUN_00431af0(7);

    if (cVar1 != '\0') {

      FUN_0045d350(param_1);

      *(uint *)(param_1 + 0x660) = *(uint *)(param_1 + 0x660) | 0x40;

    }

  }

  return;

}





// --- FUN_0046df50 at 0x0046DF50 (size: 27) ---


void __fastcall FUN_0046df50(int param_1)



{

  uint uVar1;

  

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

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

    *(uint *)(param_1 + 0x660) = uVar1 | 0x100;

  }

  return;

}





// --- FUN_0046df70 at 0x0046DF70 (size: 65) ---


void __fastcall FUN_0046df70(int param_1)



{

  if ((*(uint *)(param_1 + 0x660) & 0x100) != 0) {

    *(uint *)(param_1 + 0x660) = *(uint *)(param_1 + 0x660) & 0xfffffeff;

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

      (**(code **)(**(int **)(param_1 + 0x618) + 0x9c))(*(undefined4 *)(param_1 + 0x61c));

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

    }

  }

  return;

}





// --- FUN_0046e070 at 0x0046E070 (size: 176) ---


undefined4 * __thiscall FUN_0046e070(undefined4 *param_1,undefined4 param_2,undefined4 param_3)



{

  FUN_00474150(param_2,param_3);

  *param_1 = &PTR_FUN_0079ddc0;

  param_1[0x182] = 0;

  param_1[0x183] = 0;

  param_1[0x184] = 0;

  param_1[0x185] = 0;

  param_1[0x186] = 0;

  param_1[0x187] = 0;

  param_1[0x188] = 0;

  param_1[0x189] = 0;

  param_1[0x18a] = 0;

  param_1[0x18b] = 0;

  param_1[0x18c] = 0;

  param_1[0x18d] = 0;

  param_1[0x18e] = 0;

  param_1[399] = 0;

  param_1[400] = 0;

  param_1[0x191] = 0;

  param_1[0x192] = 0;

  param_1[0x193] = 0;

  param_1[0x194] = 0;

  param_1[0x195] = 0;

  param_1[0x196] = 0;

  param_1[0x197] = 0;

  param_1[0x198] = 0x290;

  return param_1;

}





// --- FUN_0046e140 at 0x0046E140 (size: 196) ---


void __fastcall FUN_0046e140(undefined4 *param_1)



{

  *param_1 = &PTR_FUN_0079ddc0;

  if ((*(byte *)(param_1 + 0x198) & 0x40) != 0) {

    param_1[0x198] = param_1[0x198] & 0xffffffbf;

  }

  if ((param_1[0x198] & 0x100) != 0) {

    param_1[0x198] = param_1[0x198] & 0xfffffeff;

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

      (**(code **)(*(int *)param_1[0x186] + 0x9c))(param_1[0x187]);

      param_1[0x186] = 0;

    }

  }

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

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

  }

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

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

  }

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

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

  }

  FUN_00474850();

  return;

}





// --- FUN_0046e240 at 0x0046E240 (size: 77) ---


bool FUN_0046e240(int *param_1)



{

  char cVar1;

  char cVar2;

  

  cVar1 = FUN_00474430(param_1);

  FUN_00425ba0();

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

    return false;

  }

  cVar2 = FUN_00427240(0xc,param_1);

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

  return cVar2 != '\0' && cVar1 != '\0';

}





// --- FUN_0046e290 at 0x0046E290 (size: 82) ---


void __thiscall FUN_0046e290(int param_1,undefined4 param_2)



{

  undefined4 uVar1;

  

  uVar1 = param_2;

  FUN_004616b0(param_2);

  if (((((char)uVar1 != '\0') && ((*(uint *)(param_1 + 0x660) & 0x100) == 0)) && (DAT_0083e03c != 0)

      ) && (*(int *)(DAT_0083e03c + 0x31c) != 0)) {

    FUN_00460cc0(0x36,&param_2);

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

      FUN_0046df50();

    }

  }

  return;

}





// --- FUN_0046e360 at 0x0046E360 (size: 57) ---


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



{

  char cVar1;

  

  cVar1 = FUN_0046dd60(param_2,param_3,&param_3);

  if (cVar1 != '\0') {

    return *(undefined4 *)(*(int *)(param_1 + 0x608) + param_3 * 4);

  }

  return 0;

}





// --- FUN_0046e3a0 at 0x0046E3A0 (size: 62) ---


void __thiscall FUN_0046e3a0(int param_1,int param_2)



{

  uint uVar1;

  int *piVar2;

  

  uVar1 = 0;

  if (param_2 == 0) {

    return;

  }

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

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

    do {

      if (*piVar2 == param_2) break;

      uVar1 = uVar1 + 1;

      piVar2 = piVar2 + 1;

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

  }

  FUN_0046de80();

  return;

}





// --- FUN_0046e3e0 at 0x0046E3E0 (size: 77) ---


undefined4 __thiscall FUN_0046e3e0(int param_1,int param_2)



{

  uint uVar1;

  int iVar2;

  int *piVar3;

  

  if (param_2 != 0) {

    uVar1 = 0;

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

      piVar3 = *(int **)(param_1 + 0x608);

      do {

        if (*piVar3 == param_2) goto LAB_0046e40f;

        uVar1 = uVar1 + 1;

        piVar3 = piVar3 + 1;

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

    }

    uVar1 = 0xffffffff;

LAB_0046e40f:

    iVar2 = FUN_0046de80(uVar1);

    if (iVar2 != 0) {

      FUN_00460250();

      return 1;

    }

  }

  return 0;

}





// --- FUN_0046e430 at 0x0046E430 (size: 39) ---


uint __thiscall FUN_0046e430(int param_1,uint param_2)



{

  int iVar1;

  uint uVar2;

  

  if ((param_2 < *(uint *)(param_1 + 0x610)) &&

     (iVar1 = param_2 * 4, param_2 = 0, *(int *)(*(int *)(param_1 + 0x608) + iVar1) != 0)) {

    uVar2 = FUN_0046e3e0();

    return uVar2;

  }

  return param_2 & 0xffffff00;

}





// --- FUN_0046e460 at 0x0046E460 (size: 180) ---


void __fastcall FUN_0046e460(int param_1)



{

  int iVar1;

  uint uVar2;

  

  uVar2 = 0;

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

    do {

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

        FUN_00460250();

      }

      uVar2 = uVar2 + 1;

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

  }

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

  if ((*(uint *)(param_1 + 0x60c) & 0x80000000) == 0x80000000) {

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

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

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

  }

  else if (*(int *)(param_1 + 0x608) != 0) {

    iVar1 = (*(uint *)(param_1 + 0x60c) & 0x7fffffff) - 1;

    while (-1 < iVar1) {

      iVar1 = iVar1 + -1;

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

    }

  }

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

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

  *(uint *)(param_1 + 0x660) = *(uint *)(param_1 + 0x660) | 0x200;

  FUN_006a0430();

  return;

}





// --- FUN_0046e520 at 0x0046E520 (size: 30) ---


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



{

  FUN_0046e140();

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

    operator_delete(param_1);

  }

  return param_1;

}





// --- FUN_0046e540 at 0x0046E540 (size: 16) ---


void FUN_0046e540(void)



{

  FUN_00460270(5,&LAB_0046e210);

  return;

}





// --- FUN_0046e550 at 0x0046E550 (size: 122) ---


void __thiscall FUN_0046e550(int param_1,char param_2)



{

  char cVar1;

  uint uVar2;

  int iVar3;

  int *piVar4;

  uint uVar5;

  

  if (param_2 == '\0') {

    uVar5 = *(uint *)(param_1 + 0x624);

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

  }

  else {

    uVar5 = *(uint *)(param_1 + 0x620);

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

  }

  if ((piVar4[1] & 0x7fffffffU) < uVar5) {

    cVar1 = FUN_004180a0(uVar5);

    if (cVar1 == '\0') goto LAB_0046e5b4;

  }

  else {

    uVar2 = uVar5;

    if (uVar5 < (uint)piVar4[2]) {

      do {

        *(undefined4 *)(*piVar4 + uVar2 * 4) = 0;

        uVar2 = uVar2 + 1;

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

    }

  }

  piVar4[2] = uVar5;

LAB_0046e5b4:

  iVar3 = 0;

  if (0 < (int)uVar5) {

    do {

      *(undefined4 *)(*piVar4 + iVar3 * 4) = 0;

      iVar3 = iVar3 + 1;

    } while (iVar3 < (int)uVar5);

  }

  return;

}





// --- FUN_0046e5e0 at 0x0046E5E0 (size: 108) ---


undefined4 __fastcall FUN_0046e5e0(int param_1)



{

  char cVar1;

  undefined4 uVar2;

  int iVar3;

  int iVar4;

  int iVar5;

  int iVar6;

  int iStack_4;

  

  uVar2 = 0;

  if ((*(uint *)(param_1 + 0xa4) >> 4 & 1) != 0) {

    iStack_4 = param_1;

    iVar3 = (**(code **)(*DAT_00837ff4 + 0x18))();

    iVar4 = FUN_0069fe00();

    iVar5 = (**(code **)(*DAT_00837ff4 + 0x1c))();

    iVar6 = FUN_0069fe30();

    uVar2 = 0;

    cVar1 = FUN_0046dd60(iVar3 - iVar4,iVar5 - iVar6,&iStack_4);

    if (cVar1 != '\0') {

      uVar2 = *(undefined4 *)(*(int *)(param_1 + 0x608) + iStack_4 * 4);

    }

  }

  return uVar2;

}





// --- FUN_0046e650 at 0x0046E650 (size: 179) ---


void __fastcall FUN_0046e650(uint param_1)



{

  int *piVar1;

  char cVar2;

  int *piVar3;

  int iVar4;

  undefined4 uStack_4;

  

  if (DAT_0083e03c == 0) {

    return;

  }

  iVar4 = *(int *)(DAT_0083e03c + 0x31c);

  if (iVar4 == 0) {

    uStack_4 = param_1;

    FUN_0046df70();

    return;

  }

  uStack_4 = param_1 & 0xffffff;

  FUN_00460cc0(0x38,(int)&uStack_4 + 3);

  cVar2 = (**(code **)(param_1 + 0x49c))(iVar4,param_1);

  if (cVar2 != '\0') {

    iVar4 = 9;

    if (uStack_4._3_1_ == '\0') goto LAB_0046e6a9;

  }

  iVar4 = 10;

LAB_0046e6a9:

  piVar3 = (int *)FUN_0046e5e0();

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

  if (piVar1 != piVar3) {

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

      (**(code **)(*piVar1 + 0x9c))(*(undefined4 *)(param_1 + 0x61c));

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

    }

    if ((piVar3 != (int *)0x0) && (iVar4 != piVar3[0x100])) {

      *(int *)(param_1 + 0x61c) = piVar3[0x100];

      *(int **)(param_1 + 0x618) = piVar3;

      (**(code **)(*piVar3 + 0x9c))(iVar4);

    }

  }

  return;

}





// --- FUN_0046e710 at 0x0046E710 (size: 77) ---


void __thiscall FUN_0046e710(int param_1,int param_2)



{

  int iVar1;

  

  if (((*(int *)(param_2 + 8) == 0x1c) && (*(int *)(param_2 + 0xc) == 7)) &&

     ((*(byte *)(param_1 + 0x660) & 2) != 0)) {

    iVar1 = FUN_0046e5e0();

    if (iVar1 != 0) {

      FUN_0046dc70(iVar1,1);

      if ((*(byte *)(param_1 + 0x660) & 4) != 0) {

        FUN_0046df10();

      }

    }

  }

  FUN_00474920(param_2);

  return;

}





// --- FUN_0046e820 at 0x0046E820 (size: 752) ---


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



void __fastcall FUN_0046e820(int *param_1)



{

  uint uVar1;

  float fVar2;

  uint *puVar3;

  uint *puVar4;

  int *piVar5;

  int iVar6;

  int *piVar7;

  int iVar8;

  int iVar9;

  uint local_14;

  int local_10;

  uint local_c;

  uint local_8;

  int *local_4;

  

  if ((param_1[0x198] & 0x200U) != 0) {

    param_1[0x198] = param_1[0x198] & 0xfffffdff;

    FUN_006a0430();

    uVar1 = param_1[0x184];

    iVar9 = 0;

    local_14 = 0;

    local_8 = uVar1;

    FUN_00460b30(0x5f,&local_14);

    if ((int)local_14 < 0) {

      param_1[0x188] = uVar1;

      param_1[0x189] = (uint)(uVar1 != 0);

    }

    else {

      local_c = 1;

      puVar3 = &local_c;

      if (0 < (int)local_14) {

        puVar3 = &local_14;

      }

      local_14 = *puVar3;

      local_c = uVar1;

      puVar4 = &local_14;

      if ((int)uVar1 <= (int)*puVar3) {

        puVar4 = &local_c;

      }

      local_c = *puVar4;

      param_1[0x188] = local_c;

      if (local_c == 0) {

        iVar8 = 0;

      }

      else {

        fVar2 = (float)(int)uVar1;

        if ((int)uVar1 < 0) {

          fVar2 = fVar2 + _DAT_0079920c;

        }

        local_4 = (int *)uVar1;

        ceil((double)(fVar2 / (float)(int)local_c));

        iVar8 = FUN_005df4c4();

      }

      param_1[0x189] = iVar8;

    }

    FUN_0046e550();

    FUN_0046e550();

    iVar8 = 0;

    local_c = 0;

    if (uVar1 != 0) {

      do {

        if (*(int *)(param_1[0x182] + local_c * 4) != 0) {

          local_10 = FUN_0069fe60();

          piVar7 = (int *)(param_1[0x18d] + iVar8 * 4);

          piVar5 = &local_10;

          if (local_10 <= *(int *)(param_1[0x18d] + iVar8 * 4)) {

            piVar5 = piVar7;

          }

          *piVar7 = *piVar5;

          local_10 = FUN_0069fe70();

          piVar7 = (int *)(param_1[0x18a] + iVar9 * 4);

          piVar5 = &local_10;

          if (local_10 <= *(int *)(param_1[0x18a] + iVar9 * 4)) {

            piVar5 = piVar7;

          }

          *piVar7 = *piVar5;

          if ((*(byte *)(param_1 + 0x198) & 1) == 0) {

            if (iVar9 == param_1[0x189] + -1) {

              iVar9 = 0;

              goto LAB_0046ead7;

            }

          }

          else {

            if (iVar8 != param_1[0x188] + -1) {

LAB_0046ead7:

              iVar8 = iVar8 + 1;

              goto LAB_0046e996;

            }

            iVar8 = 0;

          }

          iVar9 = iVar9 + 1;

        }

LAB_0046e996:

        local_c = local_c + 1;

      } while (local_c < local_8);

    }

    iVar9 = param_1[0x188];

    if ((param_1[0x198] & 0x200U) != 0) {

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

    }

    if (iVar9 == -1) {

      iVar9 = param_1[0x188];

    }

    iVar8 = 0;

    if (0 < iVar9) {

      piVar7 = (int *)param_1[0x18d];

      do {

        iVar8 = iVar8 + *piVar7;

        piVar7 = piVar7 + 1;

        iVar9 = iVar9 + -1;

      } while (iVar9 != 0);

    }

    iVar9 = param_1[0x189];

    if ((param_1[0x198] & 0x200U) != 0) {

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

    }

    if (iVar9 == -1) {

      iVar9 = param_1[0x189];

    }

    iVar6 = 0;

    if (0 < iVar9) {

      piVar7 = (int *)param_1[0x18a];

      do {

        iVar6 = iVar6 + *piVar7;

        piVar7 = piVar7 + 1;

        iVar9 = iVar9 + -1;

      } while (iVar9 != 0);

    }

    iVar9 = 0;

    FUN_00474af0(iVar8,iVar6);

    iVar8 = -param_1[0x17e];

    iVar6 = -param_1[0x17f];

    local_10 = 0;

    local_c = 0;

    if (local_8 != 0) {

      do {

        local_4 = *(int **)(param_1[0x182] + local_c * 4);

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

           (piVar7 = (int *)(**(code **)(*local_4 + 0xa0))(), piVar7 == param_1)) {

          (**(code **)(*local_4 + 0x2c))(iVar8,iVar6);

          if ((*(byte *)(param_1 + 0x198) & 1) == 0) {

            if (iVar9 != param_1[0x189] + -1) goto LAB_0046eaa3;

            iVar6 = -param_1[0x17f];

            iVar8 = iVar8 + *(int *)(param_1[0x18d] + local_10 * 4);

            iVar9 = 0;

            local_10 = local_10 + 1;

          }

          else if (local_10 == param_1[0x188] + -1) {

            iVar8 = -param_1[0x17e];

            local_10 = 0;

LAB_0046eaa3:

            iVar6 = iVar6 + *(int *)(param_1[0x18a] + iVar9 * 4);

            iVar9 = iVar9 + 1;

          }

          else {

            iVar8 = iVar8 + *(int *)(param_1[0x18d] + local_10 * 4);

            local_10 = local_10 + 1;

          }

        }

        local_c = local_c + 1;

      } while (local_c < local_8);

    }

  }

  return;

}





// --- FUN_0046eb20 at 0x0046EB20 (size: 121) ---


undefined4 __thiscall FUN_0046eb20(int param_1,int *param_2)



{

  uint uVar1;

  undefined4 *puVar2;

  

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

    return 0;

  }

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

  uVar1 = 0;

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

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

    do {

      if ((int *)*puVar2 == param_2) {

        if (uVar1 != 0xffffffff) {

          return 1;

        }

        break;

      }

      uVar1 = uVar1 + 1;

      puVar2 = puVar2 + 1;

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

  }

  FUN_0044a770(&stack0x00000000,param_2);

  *(uint *)(param_1 + 0x660) = *(uint *)(param_1 + 0x660) | 0x200;

  FUN_006a0430();

  return 1;

}





// --- FUN_0046eba0 at 0x0046EBA0 (size: 165) ---


int __thiscall FUN_0046eba0(int param_1,undefined *param_2)



{

  LONG LVar1;

  undefined4 *puVar2;

  

  if ((*(int *)(param_1 + 0x624) < 1) || (*(int *)(param_1 + 0x620) < 1)) {

    param_2 = PTR_DAT_00818344;

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

    FUN_00402710(&param_2,

                 "The number of calculated rows [%d] and/or columns [%d] do not reflect the number of items [%d] in the list box. UpateLayout needs to be called to re-calculate the number of rows and columns."

                 ,*(undefined4 *)(param_1 + 0x624),*(undefined4 *)(param_1 + 0x620),

                 *(undefined4 *)(param_1 + 0x610));

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

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

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

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

    }

  }

  else if ((-1 < (int)param_2) && ((int)param_2 < *(int *)(param_1 + 0x610))) {

    if ((*(byte *)(param_1 + 0x660) & 1) != 0) {

      return (int)param_2 % *(int *)(param_1 + 0x620);

    }

    return (int)param_2 / *(int *)(param_1 + 0x624);

  }

  return -1;

}





// --- FUN_0046ec50 at 0x0046EC50 (size: 165) ---


int __thiscall FUN_0046ec50(int param_1,undefined *param_2)



{

  LONG LVar1;

  undefined4 *puVar2;

  

  if ((*(int *)(param_1 + 0x624) < 1) || (*(int *)(param_1 + 0x620) < 1)) {

    param_2 = PTR_DAT_00818344;

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

    FUN_00402710(&param_2,

                 "The number of calculated rows [%d] and/or columns [%d] do not reflect the number of items [%d] in the list box. UpateLayout needs to be called to re-calculate the number of rows and columns."

                 ,*(undefined4 *)(param_1 + 0x624),*(undefined4 *)(param_1 + 0x620),

                 *(undefined4 *)(param_1 + 0x610));

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

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

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

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

    }

  }

  else if ((-1 < (int)param_2) && ((int)param_2 < *(int *)(param_1 + 0x610))) {

    if ((*(byte *)(param_1 + 0x660) & 1) != 0) {

      return (int)param_2 / *(int *)(param_1 + 0x620);

    }

    return (int)param_2 % *(int *)(param_1 + 0x624);

  }

  return -1;

}





// --- FUN_0046ed00 at 0x0046ED00 (size: 170) ---


void __thiscall FUN_0046ed00(int *param_1,int param_2)



{

  int iVar1;

  int iVar2;

  int *piVar3;

  int iVar4;

  

  if ((-1 < param_2) && (param_2 < param_1[0x184])) {

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

    iVar1 = FUN_0046eba0(param_2);

    iVar2 = FUN_0046ec50(param_2);

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

      if ((param_1[0x198] & 0x200U) != 0) {

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

      }

      iVar4 = 0;

      if (0 < iVar1) {

        piVar3 = (int *)param_1[0x18d];

        do {

          iVar4 = iVar4 + *piVar3;

          piVar3 = piVar3 + 1;

          iVar1 = iVar1 + -1;

        } while (iVar1 != 0);

      }

      if ((param_1[0x198] & 0x200U) != 0) {

        (**(code **)(*param_1 + 0x160))();

      }

      iVar1 = 0;

      if (0 < iVar2) {

        piVar3 = (int *)param_1[0x18a];

        do {

          iVar1 = iVar1 + *piVar3;

          piVar3 = piVar3 + 1;

          iVar2 = iVar2 + -1;

        } while (iVar2 != 0);

      }

      FUN_00474480(iVar4,iVar1,0);

    }

  }

  return;

}





// --- FUN_0046edb0 at 0x0046EDB0 (size: 355) ---


void __thiscall FUN_0046edb0(int *param_1,int param_2)



{

  int iVar1;

  int iVar2;

  int iVar3;

  int *piVar4;

  int iVar5;

  int iVar6;

  int iVar7;

  int iVar8;

  int iVar9;

  undefined8 uVar10;

  int iStack_1c;

  

  if ((-1 < param_2) && (param_2 < param_1[0x184])) {

    (**(code **)(*param_1 + 0x160))();

    iVar2 = FUN_0046eba0(param_2);

    iVar3 = FUN_0046ec50(param_2);

    if ((iVar2 != -1) && (iVar3 != -1)) {

      if ((param_1[0x198] & 0x200U) != 0) {

        (**(code **)(*param_1 + 0x160))();

      }

      iVar9 = 0;

      if (0 < iVar2) {

        piVar4 = (int *)param_1[0x18d];

        do {

          iVar9 = iVar9 + *piVar4;

          piVar4 = piVar4 + 1;

          iVar2 = iVar2 + -1;

        } while (iVar2 != 0);

      }

      if ((param_1[0x198] & 0x200U) != 0) {

        (**(code **)(*param_1 + 0x160))();

      }

      iVar2 = 0;

      if (0 < iVar3) {

        piVar4 = (int *)param_1[0x18a];

        do {

          iVar2 = iVar2 + *piVar4;

          piVar4 = piVar4 + 1;

          iVar3 = iVar3 + -1;

        } while (iVar3 != 0);

      }

      iVar3 = param_1[0x17f];

      iVar1 = param_1[0x17e];

      iVar5 = FUN_0069fe60();

      iVar6 = FUN_0069fe70();

      iStack_1c = 0;

      uVar10 = FUN_0046dc50(param_2);

      iVar8 = (int)((ulonglong)uVar10 >> 0x20);

      if ((int)uVar10 == 0) {

        iVar7 = 0;

      }

      else {

        iStack_1c = FUN_0069fe60();

        iVar7 = FUN_0069fe70();

        iVar8 = iVar6;

      }

      if ((iVar1 <= iVar9) && (iVar3 <= iVar2)) {

        if ((iVar5 + iVar1) - iStack_1c < iVar9) {

          iVar9 = (iVar9 - iVar5) + iStack_1c;

        }

        else {

          if (iVar2 <= (iVar6 + iVar3) - iVar7) {

            return;

          }

          iVar2 = (iVar2 - iVar8) + iVar7;

        }

      }

      FUN_00474480(iVar9,iVar2,0);

    }

  }

  return;

}





// --- FUN_0046ef20 at 0x0046EF20 (size: 63) ---


void __thiscall FUN_0046ef20(int param_1,int param_2)



{

  uint uVar1;

  int *piVar2;

  

  if (*(int *)(param_1 + 0x610) == 0) {

    return;

  }

  uVar1 = 0;

  if (*(uint *)(param_1 + 0x610) != 0) {

    piVar2 = *(int **)(param_1 + 0x608);

    do {

      if (*piVar2 == param_2) break;

      uVar1 = uVar1 + 1;

      piVar2 = piVar2 + 1;

    } while (uVar1 < *(uint *)(param_1 + 0x610));

  }

  FUN_0046ed00();

  return;

}





// --- FUN_0046ef60 at 0x0046EF60 (size: 81) ---


void __thiscall FUN_0046ef60(int param_1,uint param_2,undefined4 param_3)



{

  if (param_2 < *(uint *)(param_1 + 0x610)) {

    FUN_0046dc70(*(undefined4 *)(*(int *)(param_1 + 0x608) + param_2 * 4),param_3);

    FUN_0046ef20(*(undefined4 *)(*(int *)(param_1 + 0x608) + param_2 * 4));

    return;

  }

  FUN_0046dc70(0,param_3);

  return;

}





// --- FUN_0046efc0 at 0x0046EFC0 (size: 72) ---


uint __thiscall FUN_0046efc0(int param_1,int param_2,int param_3)



{

  uint in_EAX;

  uint uVar1;

  int *piVar2;

  

  if ((param_2 == 0) || (param_3 == 0)) {

    return in_EAX & 0xffffff00;

  }

  uVar1 = 0;

  if (*(uint *)(param_1 + 0x610) != 0) {

    piVar2 = *(int **)(param_1 + 0x608);

    do {

      if (*piVar2 == param_3) goto LAB_0046eff4;

      uVar1 = uVar1 + 1;

      piVar2 = piVar2 + 1;

    } while (uVar1 < *(uint *)(param_1 + 0x610));

  }

  uVar1 = 0xffffffff;

LAB_0046eff4:

  uVar1 = FUN_0046eb20(param_2,uVar1);

  return uVar1;

}





// --- FUN_0046f010 at 0x0046F010 (size: 137) ---


undefined4 __thiscall FUN_0046f010(int param_1,int *param_2)



{

  uint uVar1;

  uint uVar2;

  int *piVar3;

  bool bVar4;

  

  uVar2 = 0;

  if (*(uint *)(param_1 + 0x610) != 0) {

    piVar3 = *(int **)(param_1 + 0x608);

    do {

      if (*piVar3 == *(int *)(param_1 + 0x614)) goto LAB_0046f03f;

      uVar2 = uVar2 + 1;

      piVar3 = piVar3 + 1;

    } while (uVar2 < *(uint *)(param_1 + 0x610));

  }

  uVar2 = 0xffffffff;

LAB_0046f03f:

  uVar2 = *param_2 + uVar2;

  if ((int)uVar2 < 0) {

    uVar2 = *(int *)(param_1 + 0x610) - 1;

  }

  uVar1 = *(uint *)(param_1 + 0x610);

  bVar4 = uVar2 < uVar1;

  if ((int)uVar1 <= (int)uVar2) {

    uVar2 = 0;

    bVar4 = uVar1 != 0;

  }

  if (bVar4) {

    FUN_0046dc70(*(undefined4 *)(*(int *)(param_1 + 0x608) + uVar2 * 4),1);

    FUN_0046ef20(*(undefined4 *)(*(int *)(param_1 + 0x608) + uVar2 * 4));

    return 1;

  }

  FUN_0046dc70(0,1);

  return 1;

}





// --- FUN_0046f0a0 at 0x0046F0A0 (size: 136) ---


void __thiscall FUN_0046f0a0(int param_1,int param_2,undefined4 param_3)



{

  uint uVar1;

  int *piVar2;

  uint uVar3;

  

  uVar1 = *(uint *)(param_1 + 0x610);

  uVar3 = 0;

  if (uVar1 != 0) {

    piVar2 = *(int **)(param_1 + 0x608);

    do {

      if (*(int *)(*piVar2 + 0x2e4) == param_2) {

        if (uVar3 < uVar1) {

          FUN_0046dc70((*(int **)(param_1 + 0x608))[uVar3],param_3);

          FUN_0046ef20(*(undefined4 *)(*(int *)(param_1 + 0x608) + uVar3 * 4));

          return;

        }

        FUN_0046dc70(0,param_3);

        return;

      }

      uVar3 = uVar3 + 1;

      piVar2 = piVar2 + 1;

    } while (uVar3 < uVar1);

  }

  FUN_0046dc70(0,param_3);

  return;

}





// --- FUN_0046f130 at 0x0046F130 (size: 73) ---


undefined4 __thiscall FUN_0046f130(int param_1,int *param_2)



{

  char cVar1;

  

  if (param_2 != (int *)0x0) {

    (**(code **)(*param_2 + 0x44))(param_1);

    cVar1 = FUN_00455770(&stack0x00000000);

    if (cVar1 != '\0') {

      *(uint *)(param_1 + 0x660) = *(uint *)(param_1 + 0x660) | 0x200;

      FUN_006a0430();

    }

    return 1;

  }

  return 0;

}





// --- FUN_0046f180 at 0x0046F180 (size: 94) ---


int __thiscall FUN_0046f180(undefined4 param_1,undefined4 param_2,undefined4 param_3,int param_4)



{

  char cVar1;

  int iVar2;

  

  iVar2 = 0;

  if ((DAT_0083e03c != 0) && (iVar2 = FUN_0045e580(param_1,param_2,param_3), iVar2 != 0)) {

    if (param_4 == 0) {

      cVar1 = FUN_0046f130(iVar2);

    }

    else {

      cVar1 = FUN_0046efc0(iVar2,param_4);

    }

    if (cVar1 == '\0') {

      FUN_0045b350(iVar2);

      return 0;

    }

  }

  return iVar2;

}





// --- FUN_0046f2c0 at 0x0046F2C0 (size: 617) ---


undefined4 __thiscall FUN_0046f2c0(int *param_1,int param_2,undefined4 param_3)



{

  int iVar1;

  char cVar2;

  int *piVar3;

  undefined4 unaff_EBX;

  uint uVar4;

  uint uStack_3c;

  int local_38;

  undefined4 uStack_34;

  undefined4 *puStack_30;

  int *piStack_2c;

  undefined4 *local_28;

  int *local_24;

  undefined4 *puStack_20;

  int *piStack_1c;

  undefined4 *puStack_18;

  int *piStack_14;

  

  local_38 = 0;

  local_28 = (undefined4 *)0x0;

  local_24 = (int *)0x0;

  cVar2 = (**(code **)(*param_1 + 0xd0))(100,&local_28);

  piVar3 = piStack_2c;

  if (cVar2 != '\0') {

    uStack_3c = 0;

    if (piStack_2c != (int *)0x0) {

      (**(code **)(*piStack_2c + 0xf0))(&uStack_3c);

    }

    uVar4 = 0;

    piVar3 = piStack_2c;

    if (uStack_3c != 0) {

      do {

        local_28 = (undefined4 *)0x0;

        local_24 = (int *)0x0;

        if (piVar3 != (int *)0x0) {

          cVar2 = (**(code **)(*piVar3 + 0xf4))(uVar4,&local_28);

          if (cVar2 != '\0') {

            puStack_18 = (undefined4 *)0x0;

            piStack_14 = (int *)0x0;

            puStack_20 = (undefined4 *)0x0;

            piStack_1c = (int *)0x0;

            if (local_24 != (int *)0x0) {

              cVar2 = (**(code **)(*local_24 + 0x118))(99,&puStack_18);

              if (((((cVar2 != '\0') && (local_24 != (int *)0x0)) &&

                   (cVar2 = (**(code **)(*local_24 + 0x118))(0x62,&puStack_20), cVar2 != '\0')) &&

                  ((piStack_14 != (int *)0x0 &&

                   (cVar2 = (**(code **)(*piStack_14 + 0xb0))(&uStack_34), cVar2 != '\0')))) &&

                 ((piStack_1c != (int *)0x0 &&

                  ((cVar2 = (**(code **)(*piStack_1c + 0xa8))(&local_38), cVar2 != '\0' &&

                   (local_38 == param_2)))))) {

                unaff_EBX = FUN_0046f180(uStack_34,local_38,param_3);

                FUN_004234d0();

                FUN_004234d0();

                FUN_004234d0();

                piVar3 = piStack_2c;

                break;

              }

              if (puStack_20 != (undefined4 *)0x0) {

                iVar1 = puStack_20[1];

                puStack_20[1] = iVar1 + -1;

                if (iVar1 + -1 == 0) {

                  (**(code **)*puStack_20)(1);

                }

                puStack_20 = (undefined4 *)0x0;

              }

              if (piStack_1c != (int *)0x0) {

                iVar1 = piStack_1c[1];

                piStack_1c[1] = iVar1 + -1;

                if (iVar1 + -1 == 0) {

                  (**(code **)*piStack_1c)(1);

                }

                piStack_1c = (int *)0x0;

              }

              if (puStack_18 != (undefined4 *)0x0) {

                iVar1 = puStack_18[1];

                puStack_18[1] = iVar1 + -1;

                if (iVar1 + -1 == 0) {

                  (**(code **)*puStack_18)(1);

                }

                puStack_18 = (undefined4 *)0x0;

              }

              if (piStack_14 != (int *)0x0) {

                iVar1 = piStack_14[1];

                piStack_14[1] = iVar1 + -1;

                if (iVar1 + -1 == 0) {

                  (**(code **)*piStack_14)(1);

                }

                piStack_14 = (int *)0x0;

              }

            }

          }

          if (local_28 != (undefined4 *)0x0) {

            iVar1 = local_28[1];

            local_28[1] = iVar1 + -1;

            if (iVar1 + -1 == 0) {

              (**(code **)*local_28)(1);

            }

            local_28 = (undefined4 *)0x0;

          }

          piVar3 = piStack_2c;

          if (local_24 != (int *)0x0) {

            iVar1 = local_24[1];

            local_24[1] = iVar1 + -1;

            if (iVar1 + -1 == 0) {

              (**(code **)*local_24)(1);

            }

            local_24 = (int *)0x0;

            piVar3 = piStack_2c;

          }

        }

        uVar4 = uVar4 + 1;

      } while (uVar4 < uStack_3c);

    }

  }

  if (puStack_30 != (undefined4 *)0x0) {

    iVar1 = puStack_30[1];

    puStack_30[1] = iVar1 + -1;

    if (iVar1 + -1 == 0) {

      (**(code **)*puStack_30)(1);

    }

    puStack_30 = (undefined4 *)0x0;

    piVar3 = piStack_2c;

  }

  if ((piVar3 != (int *)0x0) && (iVar1 = piVar3[1], piVar3[1] = iVar1 + -1, iVar1 + -1 == 0)) {

    (**(code **)*piVar3)(1);

  }

  return unaff_EBX;

}





// --- FUN_0046f530 at 0x0046F530 (size: 313) ---


/* WARNING: Removing unreachable block (ram,0x0046f623) */

/* WARNING: Removing unreachable block (ram,0x0046f634) */

/* WARNING: Removing unreachable block (ram,0x0046f63a) */

/* WARNING: Removing unreachable block (ram,0x0046f591) */

/* WARNING: Removing unreachable block (ram,0x0046f5a2) */

/* WARNING: Removing unreachable block (ram,0x0046f5aa) */

/* WARNING: Removing unreachable block (ram,0x0046f5bb) */

/* WARNING: Removing unreachable block (ram,0x0046f646) */

/* WARNING: Removing unreachable block (ram,0x0046f657) */



undefined4 FUN_0046f530(int param_1)



{

  int iVar1;

  char cVar2;

  undefined4 *unaff_EBX;

  undefined4 *puStack_14;

  undefined4 local_8;

  undefined4 local_4;

  

  local_8 = 0;

  local_4 = 0;

  if (*(int **)(param_1 + 4) != (int *)0x0) {

    cVar2 = (**(code **)(**(int **)(param_1 + 4) + 0x118))(99,&local_8);

    if ((cVar2 != '\0') && (*(int **)(param_1 + 4) != (int *)0x0)) {

      (**(code **)(**(int **)(param_1 + 4) + 0x118))(0x62,&stack0xffffffe8);

    }

    if ((unaff_EBX != (undefined4 *)0x0) &&

       (iVar1 = unaff_EBX[1], unaff_EBX[1] = iVar1 + -1, iVar1 + -1 == 0)) {

      (**(code **)*unaff_EBX)(1);

    }

    if ((puStack_14 != (undefined4 *)0x0) &&

       (iVar1 = puStack_14[1], puStack_14[1] = iVar1 + -1, iVar1 + -1 == 0)) {

      (**(code **)*puStack_14)(1);

    }

  }

  return 0;

}





// --- FUN_0046f670 at 0x0046F670 (size: 241) ---


undefined4 __fastcall FUN_0046f670(int *param_1)



{

  int iVar1;

  char cVar2;

  int *unaff_EBX;

  undefined4 *unaff_ESI;

  undefined4 uVar3;

  undefined4 unaff_retaddr;

  undefined4 *local_10;

  undefined4 *local_c;

  undefined4 uStack_4;

  

  uVar3 = 0;

  local_10 = (undefined4 *)0x0;

  local_c = (undefined4 *)0x0;

  cVar2 = (**(code **)(*param_1 + 0xd0))(100,&local_10);

  if (cVar2 != '\0') {

    local_10 = (undefined4 *)0x0;

    local_c = (undefined4 *)0x0;

    if (unaff_EBX != (int *)0x0) {

      cVar2 = (**(code **)(*unaff_EBX + 0xf4))(uStack_4,&local_10);

      if (cVar2 != '\0') {

        uVar3 = FUN_0046f530(&local_10,unaff_retaddr);

      }

      if (local_10 != (undefined4 *)0x0) {

        iVar1 = local_10[1];

        local_10[1] = iVar1 + -1;

        if (iVar1 + -1 == 0) {

          (**(code **)*local_10)(1);

        }

        local_10 = (undefined4 *)0x0;

      }

      if ((local_c != (undefined4 *)0x0) &&

         (iVar1 = local_c[1], local_c[1] = iVar1 + -1, iVar1 + -1 == 0)) {

        (**(code **)*local_c)(1);

      }

    }

  }

  if ((unaff_ESI != (undefined4 *)0x0) &&

     (iVar1 = unaff_ESI[1], unaff_ESI[1] = iVar1 + -1, iVar1 + -1 == 0)) {

    (**(code **)*unaff_ESI)(1);

  }

  if ((unaff_EBX != (int *)0x0) &&

     (iVar1 = unaff_EBX[1], unaff_EBX[1] = iVar1 + -1, iVar1 + -1 == 0)) {

    (**(code **)*unaff_EBX)(1);

  }

  return uVar3;

}





// --- FUN_0046f770 at 0x0046F770 (size: 270) ---


undefined4 __fastcall FUN_0046f770(int *param_1)



{

  int iVar1;

  char cVar2;

  int *unaff_EBX;

  undefined4 *unaff_ESI;

  undefined4 uVar3;

  uint unaff_retaddr;

  undefined4 *local_10;

  undefined4 *local_c;

  undefined4 uStack_4;

  

  uVar3 = 0;

  local_10 = (undefined4 *)0x0;

  local_c = (undefined4 *)0x0;

  cVar2 = (**(code **)(*param_1 + 0xd0))(100,&local_10);

  if (cVar2 != '\0') {

    local_10 = (undefined4 *)0x0;

    local_c = (undefined4 *)0x0;

    if (unaff_EBX != (int *)0x0) {

      cVar2 = (**(code **)(*unaff_EBX + 0xf4))(uStack_4,&local_10);

      if (cVar2 != '\0') {

        if (unaff_retaddr < (uint)param_1[0x184]) {

          uVar3 = *(undefined4 *)(param_1[0x182] + unaff_retaddr * 4);

        }

        else {

          uVar3 = 0;

        }

        uVar3 = FUN_0046f530(&local_10,uVar3);

      }

      if (local_10 != (undefined4 *)0x0) {

        iVar1 = local_10[1];

        local_10[1] = iVar1 + -1;

        if (iVar1 + -1 == 0) {

          (**(code **)*local_10)(1);

        }

        local_10 = (undefined4 *)0x0;

      }

      if ((local_c != (undefined4 *)0x0) &&

         (iVar1 = local_c[1], local_c[1] = iVar1 + -1, iVar1 + -1 == 0)) {

        (**(code **)*local_c)(1);

      }

    }

  }

  if ((unaff_ESI != (undefined4 *)0x0) &&

     (iVar1 = unaff_ESI[1], unaff_ESI[1] = iVar1 + -1, iVar1 + -1 == 0)) {

    (**(code **)*unaff_ESI)(1);

  }

  if ((unaff_EBX != (int *)0x0) &&

     (iVar1 = unaff_EBX[1], unaff_EBX[1] = iVar1 + -1, iVar1 + -1 == 0)) {

    (**(code **)*unaff_EBX)(1);

  }

  return uVar3;

}





// --- FUN_0046f880 at 0x0046F880 (size: 126) ---


undefined4 * __thiscall FUN_0046f880(undefined4 *param_1,undefined4 param_2,undefined4 param_3)



{

  undefined4 uVar1;

  undefined4 uVar2;

  

  FUN_00464900(param_2,param_3);

  uVar2 = DAT_0079dff4;

  uVar1 = DAT_0079dff0;

  *(undefined1 *)(param_1 + 0x17c) = 0;

  *(undefined1 *)((int)param_1 + 0x5f1) = 0;

  param_1[0x182] = 0;

  param_1[0x183] = 0;

  param_1[0x185] = 0;

  param_1[0x186] = 0;

  *param_1 = &PTR_LAB_0079dff8;

  param_1[0x17e] = uVar1;

  param_1[0x17f] = uVar2;

  param_1[0x180] = uVar1;

  param_1[0x181] = uVar2;

  param_1[0x184] = 0xffffffff;

  param_1[0x187] = 1;

  return param_1;

}





// --- FUN_0046f980 at 0x0046F980 (size: 145) ---


void __fastcall FUN_0046f980(int param_1)



{

  undefined4 uVar1;

  float local_8;

  undefined4 local_4;

  

  if (*(char *)(param_1 + 0x5f1) == '\0') {

    FUN_00460bf0(0x6b,&local_8);

    if (local_8 != DAT_00796344) {

      FUN_00460bf0(0x69,&local_4);

      FUN_00460bf0(0x66,param_1 + 0x60c);

      uVar1 = DAT_008379a8;

      *(undefined4 *)(param_1 + 0x5fc) = DAT_008379ac;

      *(undefined4 *)(param_1 + 0x5f8) = uVar1;

      *(double *)(param_1 + 0x600) = (double)(local_8 + (float)*(double *)(param_1 + 0x5f8));

      *(undefined4 *)(param_1 + 0x608) = local_4;

      *(undefined1 *)(param_1 + 0x5f1) = 1;

      FUN_00465f90(3);

    }

  }

  return;

}





// --- FUN_0046fa20 at 0x0046FA20 (size: 255) ---


void __fastcall FUN_0046fa20(int *param_1)



{

  undefined4 uVar1;

  char local_19;

  undefined1 local_18 [4];

  int local_14;

  undefined1 local_10 [16];

  

  local_19 = '\0';

  FUN_00460cc0(0x68,&local_19);

  if (param_1[0x186] == 0) {

    return;

  }

  if (local_19 == '\0') {

    uVar1 = (**(code **)(*param_1 + 0x34))(local_10);

    FUN_0069ff00(uVar1);

    return;

  }

  FUN_00460bf0(0x69,local_18);

  uVar1 = 0;

  switch(param_1[0x187]) {

  case 1:

    local_14 = FUN_0069fe60();

    local_14 = -local_14;

    goto LAB_0046fac2;

  case 2:

    local_14 = FUN_0069fe70();

    local_14 = -local_14;

    break;

  case 3:

    local_14 = FUN_0069fe60();

LAB_0046fac2:

    uVar1 = FUN_005df4c4();

    (**(code **)(*(int *)param_1[0x186] + 0x2c))(uVar1,0);

    return;

  case 4:

    local_14 = FUN_0069fe70();

    break;

  default:

    goto switchD_0046fa86_default;

  }

  uVar1 = FUN_005df4c4();

switchD_0046fa86_default:

  (**(code **)(*(int *)param_1[0x186] + 0x2c))(0,uVar1);

  return;

}





// --- FUN_0046fb60 at 0x0046FB60 (size: 16) ---


void FUN_0046fb60(void)



{

  FUN_00460270(7,&LAB_0046f920);

  return;

}





// --- FUN_0046fcb0 at 0x0046FCB0 (size: 77) ---


bool FUN_0046fcb0(int *param_1)



{

  char cVar1;

  char cVar2;

  

  cVar1 = FUN_004625b0(param_1);

  FUN_00425ba0();

  if (param_1 == (int *)0x0) {

    return false;

  }

  cVar2 = FUN_00427240(0xe,param_1);

  (**(code **)(*param_1 + 0x14))();

  return cVar2 != '\0' && cVar1 != '\0';

}





// --- FUN_0046fd00 at 0x0046FD00 (size: 655) ---


void __fastcall FUN_0046fd00(int *param_1)



{

  undefined *puVar1;

  char cVar2;

  int iVar3;

  LONG LVar4;

  int unaff_ESI;

  undefined4 *puVar5;

  int *piVar6;

  undefined4 auStack_28 [2];

  undefined4 *puStack_20;

  int *local_1c;

  undefined4 *puStack_18;

  int *piStack_14;

  undefined4 local_10;

  int *local_c;

  

  FUN_00460bf0(0x69,&local_1c);

  local_10 = 0;

  local_c = (int *)0x0;

  cVar2 = (**(code **)(*param_1 + 0xd0))(0x6d,&local_10);

  if (cVar2 != '\0') {

    if (piStack_14 != (int *)0x0) {

      (**(code **)(*piStack_14 + 0xf0))(&stack0xffffffd0);

    }

    if (unaff_ESI != 0) {

      auStack_28[0] = 1;

      puStack_20 = (undefined4 *)0x0;

      local_1c = (int *)0x0;

      cVar2 = (**(code **)(*param_1 + 0xd0))(0x6e,&puStack_20);

      if ((cVar2 != '\0') && (local_1c != (int *)0x0)) {

        (**(code **)(*local_1c + 0xa8))(auStack_28);

      }

      piVar6 = local_1c;

      iVar3 = FUN_005df4c4();

      if (param_1[0x184] != iVar3) {

        param_1[0x184] = iVar3;

        local_10 = 0;

        local_c = (int *)0x0;

        if ((((piStack_14 == (int *)0x0) ||

             (cVar2 = (**(code **)(*piStack_14 + 0xf4))(iVar3,&local_10), iVar3 = DAT_0083e5b0,

             cVar2 == '\0')) || (local_c == (int *)0x0)) ||

           ((**(code **)(*local_c + 0xb0))(&stack0xffffffd4), iVar3 == DAT_0083e5b0)) {

          InterlockedIncrement((LONG *)(PTR_DAT_00818344 + -0x10));

          cVar2 = FUN_0041b060(0x13,param_1[0xb9],&stack0xffffffd4);

          if (cVar2 == '\0') {

            FUN_00402710(&stack0xffffffd4,"0x%08X",param_1[0xb9]);

          }

          FUN_006a0660();

          FUN_004011b0();

        }

        else {

          FUN_006a07e0(iVar3,auStack_28[0]);

        }

        FUN_004234d0();

        piVar6 = local_1c;

      }

      if (puStack_20 != (undefined4 *)0x0) {

        iVar3 = puStack_20[1];

        puStack_20[1] = iVar3 + -1;

        if (iVar3 + -1 == 0) {

          (**(code **)*puStack_20)(1);

        }

        puStack_20 = (undefined4 *)0x0;

        piVar6 = local_1c;

      }

      if ((piVar6 != (int *)0x0) && (iVar3 = piVar6[1], piVar6[1] = iVar3 + -1, iVar3 + -1 == 0)) {

        (**(code **)*piVar6)(1);

      }

      goto LAB_0046ff46;

    }

  }

  puVar1 = PTR_DAT_00818344;

  InterlockedIncrement((LONG *)(PTR_DAT_00818344 + -0x10));

  cVar2 = FUN_0041b060(0x13,param_1[0xb9],&stack0xffffffd4);

  if (cVar2 == '\0') {

    FUN_00402710(&stack0xffffffd4,"0x%08X",param_1[0xb9]);

  }

  FUN_006a0660();

  puVar5 = (undefined4 *)(puVar1 + -0x14);

  LVar4 = InterlockedDecrement((LONG *)(puVar1 + -0x10));

  if ((LVar4 == 0) && (puVar5 != (undefined4 *)0x0)) {

    (**(code **)*puVar5)(1);

  }

LAB_0046ff46:

  if (puStack_18 != (undefined4 *)0x0) {

    iVar3 = puStack_18[1];

    puStack_18[1] = iVar3 + -1;

    if (iVar3 + -1 == 0) {

      (**(code **)*puStack_18)(1);

    }

    puStack_18 = (undefined4 *)0x0;

  }

  if ((piStack_14 != (int *)0x0) &&

     (iVar3 = piStack_14[1], piStack_14[1] = iVar3 + -1, iVar3 + -1 == 0)) {

    (**(code **)*piStack_14)(1);

  }

  return;

}





