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

// --- FUN_004300a0 at 0x004300A0 (size: 106) ---


undefined4 FUN_004300a0(undefined4 param_1,undefined4 param_2)



{

  undefined *puVar1;

  undefined4 uVar2;

  LONG LVar3;

  

  puVar1 = PTR_DAT_00818340;

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

  uVar2 = FUN_00402520(param_2,&stack0x0000000c);

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

    FUN_00402490(puVar1,*(int *)(puVar1 + -4) + -1);

  }

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

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

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

  }

  return uVar2;

}





// --- FUN_00430110 at 0x00430110 (size: 137) ---


void __thiscall FUN_00430110(int param_1,int param_2)



{

  uint *puVar1;

  uint uVar2;

  uint uVar3;

  

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

  FUN_0040ad10(4);

  puVar1 = (uint *)FUN_0040acf0(4);

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

    if ((*(byte *)(param_2 + 4) & 1) == 0) {

      uVar3 = *puVar1;

    }

    else {

      *puVar1 = uVar3;

    }

  }

  if ((~*(byte *)(param_2 + 4) & 1) != 0) {

    uVar2 = FUN_0040a8f0();

    if (uVar2 < uVar3) {

      FUN_0040aa50();

      return;

    }

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

    FUN_00407fe0(uVar3,1);

  }

  uVar3 = 0;

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

    do {

      FUN_004227d0(param_2);

      uVar3 = uVar3 + 1;

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

  }

  return;

}





// --- FUN_004301a0 at 0x004301A0 (size: 63) ---


uint __thiscall FUN_004301a0(int param_1,uint param_2)



{

  uint *puVar1;

  

  puVar1 = *(uint **)(*(int *)(param_1 + 0xa0) + (param_2 % *(uint *)(param_1 + 0xa8)) * 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 puVar1[2];

}





// --- FUN_004301e0 at 0x004301E0 (size: 143) ---


undefined4 * __thiscall FUN_004301e0(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_00799124;

  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_00430270 at 0x00430270 (size: 940) ---


byte __thiscall

FUN_00430270(int param_1,undefined *param_2,undefined *param_3,undefined4 param_4,char param_5)



{

  int iVar1;

  undefined *puVar2;

  char cVar3;

  undefined4 uVar4;

  int iVar5;

  int *piVar6;

  LONG LVar7;

  int *extraout_ECX;

  uint uVar8;

  undefined4 *puVar9;

  int local_24;

  uint uStack_20;

  undefined4 uStack_1c;

  int iStack_18;

  uint uStack_14;

  undefined4 uStack_10;

  undefined1 auStack_c [8];

  undefined *local_4;

  

  puVar2 = param_3;

  uVar8 = 0;

  piVar6 = *(int **)(*(int *)(param_1 + 0xa0) + ((uint)param_3 % *(uint *)(param_1 + 0xa8)) * 4);

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

    while ((undefined *)*piVar6 != param_3) {

      piVar6 = (int *)piVar6[1];

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

        return 2;

      }

    }

    if ((piVar6 != (int *)0x0) && (piVar6 = (int *)piVar6[2], piVar6 != (int *)0x0)) {

      if (*piVar6 != DAT_00837f54) {

        uVar4 = FUN_004220b0(*piVar6,0x25);

        iVar5 = FUN_00415430(uVar4);

        if (iVar5 == 0) {

          return 5;

        }

        piVar6 = (int *)FUN_004301a0(puVar2);

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

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

          return 4;

        }

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

      }

      if (param_5 == '\0') {

        FUN_0040b220();

        param_5 = '\0';

        cVar3 = '\0';

        if (piVar6[7] != 0) {

          do {

            iVar5 = *(int *)(piVar6[5] + uVar8 * 4);

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

            if (iVar1 != 1) {

              FUN_00402490(iVar5,iVar1 + -1);

            }

            if (uVar8 < (uint)piVar6[10]) {

              param_2 = PTR_DAT_00818340;

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

              cVar3 = FUN_0041ae30(piVar6[8] + uVar8 * 4,&param_2);

              puVar2 = param_2;

              if (cVar3 == '\0') {

                param_5 = '\x01';

              }

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

                FUN_00402490(param_2,*(int *)(param_2 + -4) + -1);

              }

              puVar9 = (undefined4 *)(puVar2 + -0x14);

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

              if ((LVar7 == 0) && (puVar9 != (undefined4 *)0x0)) {

                (**(code **)*puVar9)(1);

              }

            }

            uVar8 = uVar8 + 1;

            cVar3 = param_5;

          } while (uVar8 < (uint)piVar6[7]);

        }

        return -(cVar3 != '\0') & 6;

      }

      local_4 = PTR_DAT_00818344;

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

      local_24 = 0;

      uStack_20 = 0;

      uStack_1c = 0;

      param_5 = '\0';

      if (piVar6[10] != 0) {

        do {

          param_3 = PTR_DAT_00818340;

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

          cVar3 = FUN_0041ae30(piVar6[8] + uVar8 * 4,&param_3);

          if (cVar3 == '\0') {

            param_5 = '\x01';

          }

          FUN_00408e40(&param_3);

          puVar9 = (undefined4 *)(param_3 + -0x14);

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

          if ((LVar7 == 0) && (puVar9 != (undefined4 *)0x0)) {

            (**(code **)*puVar9)(1);

          }

          uVar8 = uVar8 + 1;

        } while (uVar8 < (uint)piVar6[10]);

        if (param_5 != '\0') {

          if (((uStack_20 & 0x80000000) == 0x80000000) && (local_24 != 0)) {

            FUN_00407920(3);

          }

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

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

          if ((LVar7 == 0) && (puVar9 != (undefined4 *)0x0)) {

            (**(code **)*puVar9)(1);

          }

          return 6;

        }

      }

      iStack_18 = 0;

      uStack_14 = 0;

      uStack_10 = 0;

      cVar3 = FUN_0067e150(piVar6 + 5,&local_24,piVar6 + 0xb,param_2,&iStack_18,1,auStack_c);

      puVar2 = PTR_DAT_00818344;

      if (cVar3 == '\0') {

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

        puVar9 = (undefined4 *)(puVar2 + -0x14);

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

        if ((LVar7 == 0) && (puVar9 != (undefined4 *)0x0)) {

          (**(code **)*puVar9)(1);

        }

        if (((uStack_14 & 0x80000000) == 0x80000000) && (iStack_18 != 0)) {

          FUN_00407920(3);

        }

        if (((uStack_20 & 0x80000000) == 0x80000000) && (local_24 != 0)) {

          FUN_00407920(3);

        }

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

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

        if ((LVar7 == 0) && (puVar9 != (undefined4 *)0x0)) {

          (**(code **)*puVar9)(1);

        }

        return 7;

      }

      if (((uStack_14 & 0x80000000) == 0x80000000) && (iStack_18 != 0)) {

        FUN_00407920(3);

      }

      if (((uStack_20 & 0x80000000) == 0x80000000) && (local_24 != 0)) {

        FUN_00407920(3);

      }

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

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

      if ((LVar7 == 0) && (puVar9 != (undefined4 *)0x0)) {

        (**(code **)*puVar9)(1);

      }

      return 0;

    }

  }

  return 2;

}





// --- FUN_00430620 at 0x00430620 (size: 149) ---


void __thiscall FUN_00430620(undefined4 *param_1,int param_2)



{

  char cVar1;

  undefined4 *puVar2;

  char *pcVar3;

  

  FUN_0040ad10(4);

  puVar2 = (undefined4 *)FUN_0040acf0(4);

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

    if ((*(byte *)(param_2 + 4) & 1) == 0) {

      *param_1 = *puVar2;

    }

    else {

      *puVar2 = *param_1;

    }

  }

  FUN_00430110(param_2);

  FUN_0042fc00(param_2);

  cVar1 = FUN_0042fe10();

  FUN_0040ad10(1);

  pcVar3 = (char *)FUN_0040acf0(1);

  if (pcVar3 != (char *)0x0) {

    if ((*(byte *)(param_2 + 4) & 1) == 0) {

      cVar1 = *pcVar3;

    }

    else {

      *pcVar3 = cVar1;

    }

  }

  if ((*(byte *)(param_2 + 4) & 5) == 0) {

    if (cVar1 == '\0') {

      return;

    }

    if (cVar1 != '\x01') {

      FUN_0040aa50();

    }

  }

  if (cVar1 != '\0') {

    FUN_00430110(param_2);

  }

  return;

}





// --- FUN_004306c0 at 0x004306C0 (size: 198) ---


void __fastcall FUN_004306c0(int param_1)



{

  undefined *puVar1;

  int iVar2;

  void *pvVar3;

  LONG LVar4;

  int *piVar5;

  LONG *lpAddend;

  int iVar6;

  undefined1 local_c [12];

  

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

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

  if (puVar1 != PTR_DAT_00818340) {

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

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

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

    }

    lpAddend = (LONG *)(PTR_DAT_00818340 + -0x10);

    *(undefined **)(param_1 + 0x34) = PTR_DAT_00818340;

    InterlockedIncrement(lpAddend);

  }

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

  piVar5 = (int *)FUN_0052dcf0(local_c);

  iVar6 = piVar5[2];

  iVar2 = *piVar5;

  piVar5 = (int *)piVar5[1];

  while (iVar6 != 0) {

    do {

      pvVar3 = *(void **)(iVar6 + 8);

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

        FUN_0042fd70();

        operator_delete(pvVar3);

      }

      *(undefined4 *)(iVar6 + 8) = 0;

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

    } while (iVar6 != 0);

    do {

      piVar5 = piVar5 + 1;

      if (piVar5 == (int *)(*(int *)(iVar2 + 0x60) + *(int *)(iVar2 + 0x68) * 4)) goto LAB_00430777;

      iVar6 = *piVar5;

    } while (iVar6 == 0);

  }

LAB_00430777:

  FUN_005870f0();

  return;

}





// --- FUN_00430790 at 0x00430790 (size: 82) ---


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



{

  *param_1 = &PTR_FUN_00799150;

  FUN_005870f0();

  param_1[1] = &PTR_FUN_00799124;

  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_00430850 at 0x00430850 (size: 114) ---


void __fastcall FUN_00430850(undefined4 *param_1)



{

  LONG LVar1;

  undefined4 *puVar2;

  

  *param_1 = &PTR_LAB_00799158;

  FUN_004306c0();

  param_1[0xf] = &PTR_FUN_00799150;

  FUN_005870f0();

  param_1[0x10] = &PTR_FUN_00799124;

  if ((undefined4 *)param_1[0x28] != param_1 + 0x11) {

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

  }

  param_1[0x28] = 0;

  param_1[0x29] = 0;

  param_1[0x2a] = 0;

  param_1[0x2b] = 0;

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

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

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

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

  }

  FUN_004154b0();

  return;

}





// --- FUN_004308d0 at 0x004308D0 (size: 121) ---


void FUN_004308d0(undefined4 param_1,undefined4 *param_2,int param_3)



{

  undefined4 *puVar1;

  int iVar2;

  undefined4 uVar3;

  

  FUN_0040ad10(4);

  puVar1 = (undefined4 *)FUN_0040acf0(4);

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

    if ((*(byte *)(param_3 + 4) & 1) == 0) {

      *param_2 = *puVar1;

    }

    else {

      *puVar1 = *param_2;

    }

  }

  if ((*(uint *)(param_3 + 4) >> 2 & 1) == 0) {

    if ((~*(byte *)(param_3 + 4) & 1) != 0) {

      iVar2 = FUN_005df0f5(0x3c);

      if (iVar2 == 0) {

        uVar3 = 0;

      }

      else {

        uVar3 = FUN_0042fd20();

      }

      param_2[2] = uVar3;

    }

    if (param_2[2] == 0) {

      FUN_0040aa50();

      return;

    }

    FUN_00430620(param_3);

  }

  return;

}





// --- FUN_00430980 at 0x00430980 (size: 30) ---


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



{

  FUN_00430850();

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

    operator_delete(param_1);

  }

  return param_1;

}





// --- FUN_004309a0 at 0x004309A0 (size: 435) ---


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



{

  undefined *puVar1;

  undefined *puVar2;

  uint uVar3;

  char cVar4;

  undefined *puVar5;

  byte *pbVar6;

  int *piVar7;

  int iVar8;

  uint uVar9;

  int iVar10;

  int *piVar11;

  int iVar12;

  undefined1 local_c [12];

  

  uVar3 = param_3;

  if ((~*(byte *)(param_3 + 4) & 1) != 0) {

    FUN_005c2c80();

  }

  puVar2 = PTR_DAT_00818558;

  puVar1 = PTR_DAT_00818554;

  if (((byte)*(undefined4 *)(uVar3 + 4) & 5) == 1) {

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

    puVar5 = (undefined *)FUN_00422d20(PTR_DAT_00818554,PTR_DAT_00818558,&param_3,param_3,0);

    if (puVar5 == puVar2) {

      puVar5 = puVar5 + -4;

    }

    uVar9 = (int)puVar5 - (int)puVar1 >> 2;

  }

  else {

    uVar9 = param_3 & 0xff;

  }

  FUN_0040ad10(1);

  pbVar6 = (byte *)FUN_0040acf0(1);

  if (pbVar6 != (byte *)0x0) {

    if ((*(byte *)(uVar3 + 4) & 1) == 0) {

      uVar9 = (uint)*pbVar6;

    }

    else {

      *pbVar6 = (byte)uVar9;

    }

  }

  if ((*(byte *)(uVar3 + 4) & 5) == 0) {

    if ((uVar9 & 0xff) < DAT_007956cc) {

      FUN_0042ab60(*(undefined4 *)(PTR_DAT_00818554 + (uVar9 & 0xff) * 4));

    }

    else {

      FUN_0040aa50();

    }

  }

  if (((byte)*(undefined4 *)(uVar3 + 4) & 5) == 1) {

    param_3 = *(uint *)(param_2 + 0x6c);

  }

  FUN_00401a80(&param_3,&param_3,uVar3);

  if (((byte)*(undefined4 *)(uVar3 + 4) & 5) == 1) {

    piVar7 = (int *)FUN_0052dcf0(local_c);

    iVar12 = *piVar7;

    piVar11 = (int *)piVar7[1];

    iVar10 = piVar7[2];

LAB_00430aa2:

    iVar8 = iVar10;

    if (iVar10 != 0) {

      do {

        FUN_004308d0(param_1,iVar8,uVar3);

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

      } while (iVar8 != 0);

      do {

        piVar11 = piVar11 + 1;

        iVar10 = iVar8;

        if (piVar11 == (int *)(*(int *)(iVar12 + 0x60) + *(int *)(iVar12 + 0x68) * 4)) break;

        iVar10 = *piVar11;

      } while (iVar10 == 0);

      goto LAB_00430aa2;

    }

  }

  if ((*(byte *)(uVar3 + 4) & 5) == 0) {

    uVar9 = FUN_0040a8f0();

    if (uVar9 < param_3) {

LAB_00430b44:

      FUN_0040aa50();

    }

    else {

      uVar9 = 0;

      iVar12 = 0;

      if (param_3 != 0) {

        while( true ) {

          iVar8 = FUN_005df0f5(0xc);

          iVar10 = 0;

          if (iVar8 != 0) {

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

            iVar10 = iVar8;

          }

          FUN_004308d0(param_1,iVar10,uVar3);

          if ((*(uint *)(uVar3 + 4) >> 2 & 1) != 0) break;

          cVar4 = FUN_00599310(iVar10,iVar12);

          if (cVar4 == '\0') goto LAB_00430b44;

          uVar9 = uVar9 + 1;

          iVar12 = iVar10;

          if (param_3 <= uVar9) {

            return;

          }

        }

      }

    }

  }

  return;

}





// --- FUN_00430b60 at 0x00430B60 (size: 94) ---


void __thiscall FUN_00430b60(int param_1,int param_2)



{

  int iVar1;

  undefined4 *puVar2;

  

  iVar1 = param_2;

  FUN_00415590(param_2);

  FUN_0040ad10(4);

  puVar2 = (undefined4 *)FUN_0040acf0(4);

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

    if ((*(byte *)(iVar1 + 4) & 1) == 0) {

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

    }

    else {

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

    }

  }

  if ((~*(byte *)(iVar1 + 4) & 1) != 0) {

    FUN_005870f0();

  }

  FUN_004309a0(&param_2,param_1 + 0x40,iVar1);

  return;

}





// --- FUN_00430bc0 at 0x00430BC0 (size: 265) ---


undefined1 FUN_00430bc0(int param_1,int param_2,int param_3,int param_4,int param_5)



{

  LONG LVar1;

  int iVar2;

  int iVar3;

  int iVar4;

  int iVar5;

  undefined1 local_1;

  

  local_1 = 0;

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

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

    iVar5 = param_4;

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

    iVar4 = param_3;

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

    iVar3 = param_2;

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

    iVar2 = param_1;

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

    local_1 = (**(code **)(*DAT_00837f58 + 0xc))(iVar2,iVar3,iVar4,iVar5);

  }

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

  if ((LVar1 == 0) && ((undefined4 *)(param_1 + -0x14) != (undefined4 *)0x0)) {

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

  }

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

  if ((LVar1 == 0) && ((undefined4 *)(param_2 + -0x14) != (undefined4 *)0x0)) {

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

  }

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

  if ((LVar1 == 0) && ((undefined4 *)(param_3 + -0x14) != (undefined4 *)0x0)) {

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

  }

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

  if ((LVar1 == 0) && ((undefined4 *)(param_4 + -0x14) != (undefined4 *)0x0)) {

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

  }

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

  if ((LVar1 == 0) && ((undefined4 *)(param_5 + -0x14) != (undefined4 *)0x0)) {

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

  }

  return local_1;

}





// --- FUN_00430cd0 at 0x00430CD0 (size: 146) ---


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

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

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

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

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



void __thiscall FUN_00430cd0(float *param_1,uint param_2)



{

  param_1[3] = (float)(param_2 >> 0x18) * _DAT_00799208;

  *param_1 = (float)(param_2 >> 0x10 & 0xff) * _DAT_00799208;

  param_1[1] = (float)(param_2 >> 8 & 0xff) * _DAT_00799208;

  param_1[2] = (float)(param_2 & 0xff) * _DAT_00799208;

  return;

}





// --- FUN_00430d70 at 0x00430D70 (size: 16) ---


undefined1 FUN_00430d70(void)



{

  thunk_FUN_00436cf0(&DAT_00837fec);

  return 1;

}





// --- FUN_00430d80 at 0x00430D80 (size: 89) ---


undefined4 FUN_00430d80(void)



{

  LONG LVar1;

  int local_4;

  

  FUN_00401340("A flag to use IME");

  FUN_00411d90(&DAT_00837fec,&local_4,0,0,0,0);

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

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

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

  }

  DAT_00837f61 = 1;

  return 1;

}





// --- FUN_00430e00 at 0x00430E00 (size: 77) ---


bool __fastcall FUN_00430e00(int *param_1)



{

  int iVar1;

  

  (**(code **)(*param_1 + 0x74))(DAT_00838197);

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

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

    param_1[0x23] = 0;

  }

  iVar1 = FUN_00415730(1,8,0x27);

  param_1[0x23] = iVar1;

  return iVar1 != 0;

}





// --- FUN_00430e50 at 0x00430E50 (size: 64) ---


bool __thiscall FUN_00430e50(int param_1,undefined4 param_2)



{

  int iVar1;

  

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

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

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

  }

  iVar1 = FUN_00415730(param_2,8,0x27);

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

  return iVar1 != 0;

}





// --- FUN_00430e90 at 0x00430E90 (size: 10) ---


void __thiscall FUN_00430e90(int param_1,undefined1 param_2)



{

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

  return;

}





// --- FUN_00430ea0 at 0x00430EA0 (size: 17) ---


uint __fastcall FUN_00430ea0(int param_1)



{

  uint in_EAX;

  uint uVar1;

  

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

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

                    /* WARNING: Treating indirect jump as call */

    uVar1 = (**(code **)(**(int **)(param_1 + 0x7c) + 0x14))();

    return uVar1;

  }

  return in_EAX & 0xffffff00;

}





// --- FUN_00430ec0 at 0x00430EC0 (size: 20) ---


void __thiscall FUN_00430ec0(int *param_1,int param_2)



{

  *(undefined1 *)(param_2 + 0x20) = 1;

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

                    /* WARNING: Treating indirect jump as call */

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

  return;

}





// --- FUN_00430ee0 at 0x00430EE0 (size: 51) ---


void __fastcall FUN_00430ee0(undefined4 *param_1)



{

  *param_1 = 0;

  param_1[1] = 0;

  param_1[2] = 0xffffffff;

  param_1[3] = 0;

  param_1[4] = 0;

  param_1[5] = 0xc0000000;

  param_1[6] = 0;

  param_1[7] = 0;

  param_1[10] = 0;

  param_1[0xb] = 0;

  param_1[0xc] = 0;

  param_1[0xd] = 0;

  param_1[0x10] = 0;

  return;

}





// --- FUN_00430f20 at 0x00430F20 (size: 106) ---


void __fastcall FUN_00430f20(int *param_1)



{

  undefined4 *puVar1;

  uint uVar2;

  undefined4 local_4;

  

  param_1[2] = 0;

  if ((param_1[1] & 0x80000000U) == 0x80000000) {

    operator_delete__((void *)*param_1);

    *param_1 = 0;

    param_1[1] = 0;

    return;

  }

  if (*param_1 != 0) {

    uVar2 = param_1[1] & 0x7fffffff;

    while (uVar2 = uVar2 - 1, -1 < (int)uVar2) {

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

      *puVar1 = 0xffffffff;

      puVar1[1] = local_4;

    }

  }

  return;

}





// --- FUN_00430f90 at 0x00430F90 (size: 91) ---


float10 __fastcall FUN_00430f90(int param_1)



{

  uint uVar1;

  float *pfVar2;

  uint uVar3;

  uint uVar4;

  float local_4;

  

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

  uVar4 = 0xffffffff;

  local_4 = -2.0;

  if ((uVar1 != 0) && (uVar3 = 0, uVar1 != 0)) {

    pfVar2 = (float *)(*(int *)(param_1 + 0x1c) + 4);

    do {

      if (local_4 < ABS(*pfVar2)) {

        uVar4 = uVar3;

        local_4 = ABS(*pfVar2);

      }

      uVar3 = uVar3 + 1;

      pfVar2 = pfVar2 + 2;

    } while (uVar3 < uVar1);

    if (-1 < (int)uVar4) {

      return (float10)*(float *)(*(int *)(param_1 + 0x1c) + 4 + uVar4 * 8);

    }

  }

  return (float10)DAT_00796344;

}





// --- FUN_00430ff0 at 0x00430FF0 (size: 89) ---


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



{

  float10 fVar1;

  

  *param_1 = *param_2;

  param_1[1] = 0;

  param_1[2] = 0xffffffff;

  param_1[3] = 0;

  param_1[4] = 0;

  fVar1 = (float10)FUN_00430f90();

  param_1[5] = (float)fVar1;

  param_1[6] = 0;

  param_1[7] = param_2[5];

  param_1[10] = param_2[2];

  param_1[0xb] = param_2[3];

  param_1[0xc] = 1;

  param_1[0xd] = param_2[4];

  param_1[0x10] = param_2[6];

  return param_1;

}





// --- FUN_00431050 at 0x00431050 (size: 64) ---


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



{

  *param_1 = &PTR_FUN_00799330;

  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_00431090 at 0x00431090 (size: 126) ---


void __thiscall

FUN_00431090(int param_1,int *param_2,undefined4 param_3,undefined4 param_4,undefined4 param_5,

            undefined4 param_6,undefined4 param_7)



{

  int *piVar1;

  char cVar2;

  int iVar3;

  

  piVar1 = param_2;

  if (param_1 != 0) {

    FUN_004369a0(param_1,9,param_2,param_3,param_4,param_5,param_6,param_7);

  }

  if (DAT_008380c8 == 0) {

    iVar3 = FUN_005df0f5(0x8100);

    if (iVar3 == 0) {

      DAT_008380c8 = 0;

    }

    else {

      DAT_008380c8 = FUN_00433d20();

    }

  }

  cVar2 = FUN_00433710(piVar1,&param_2);

  if ((cVar2 != '\0') && (iVar3 = (**(code **)(*param_2 + 0x44))(), iVar3 != 0)) {

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

  }

  return;

}





// --- FUN_00431110 at 0x00431110 (size: 182) ---


undefined4 __thiscall FUN_00431110(int *param_1,uint param_2)



{

  int iVar1;

  int iVar2;

  int iVar3;

  int iVar4;

  

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

    return 0;

  }

  if ((param_1[1] & 0x7fffffffU) < param_2) {

    if (param_2 == 0) {

      FUN_00430f20();

      return 1;

    }

    iVar4 = thunk_FUN_005df0f5(param_2 * 8);

    if (iVar4 == 0) {

      return 0;

    }

    FUN_00401000(iVar4,8,param_2,FUN_00677be0);

    if (*param_1 != 0) {

      iVar2 = param_1[2];

      while (iVar2 = iVar2 + -1, -1 < iVar2) {

        iVar3 = *param_1;

        iVar1 = iVar2 * 8;

        *(undefined4 *)(iVar1 + iVar4) = *(undefined4 *)(iVar3 + iVar1);

        *(undefined4 *)(iVar1 + 4 + iVar4) = *(undefined4 *)(iVar3 + iVar1 + 4);

      }

      if ((param_1[1] & 0x80000000U) == 0x80000000) {

        operator_delete__((void *)*param_1);

      }

    }

    *param_1 = iVar4;

    param_1[1] = param_2 | 0x80000000;

  }

  return 1;

}





// --- FUN_004311d0 at 0x004311D0 (size: 117) ---


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



{

  undefined4 *puVar1;

  

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

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

    return 0;

  }

  *puVar1 = *param_3;

  puVar1[1] = 0;

  puVar1[2] = 0;

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

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

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

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

    return 1;

  }

  puVar1[1] = param_2;

  puVar1[2] = *(undefined4 *)(param_2 + 8);

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

    *(undefined4 **)(*(int *)(param_2 + 8) + 4) = puVar1;

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

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

    return 1;

  }

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

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

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

  return 1;

}





// --- FUN_00431250 at 0x00431250 (size: 98) ---


undefined4 __thiscall FUN_00431250(int param_1,undefined4 *param_2)



{

  int iVar1;

  undefined4 *puVar2;

  

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

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

    return 0;

  }

  *puVar2 = *param_2;

  puVar2[1] = param_2[1];

  puVar2[2] = param_2[2];

  puVar2[3] = 0;

  puVar2[4] = 0;

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

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

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

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

    return 1;

  }

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

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

  puVar2[4] = iVar1;

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

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

  return 1;

}





// --- FUN_004312c0 at 0x004312C0 (size: 133) ---


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



{

  undefined4 *puVar1;

  

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

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

    return 0;

  }

  *puVar1 = *param_3;

  puVar1[1] = param_3[1];

  puVar1[2] = param_3[2];

  puVar1[3] = 0;

  puVar1[4] = 0;

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

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

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

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

    return 1;

  }

  puVar1[3] = param_2;

  puVar1[4] = *(undefined4 *)(param_2 + 0x10);

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

    *(undefined4 **)(*(int *)(param_2 + 0x10) + 0xc) = puVar1;

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

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

    return 1;

  }

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

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

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

  return 1;

}





// --- FUN_00431350 at 0x00431350 (size: 52) ---


void __thiscall FUN_00431350(int param_1,undefined4 param_2)



{

  undefined4 *puVar1;

  int *piVar2;

  

  if ((*(int *)(param_1 + 0x30) != 0) && (*(char *)(param_1 + 0x1a) == '\x01')) {

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

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

      piVar2 = (int *)*puVar1;

      puVar1 = (undefined4 *)puVar1[1];

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

    }

  }

  return;

}





// --- FUN_00431390 at 0x00431390 (size: 40) ---


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



{

  undefined4 *puVar1;

  int *piVar2;

  

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

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

    piVar2 = (int *)*puVar1;

    puVar1 = (undefined4 *)puVar1[1];

    (**(code **)(*piVar2 + 4))(param_2,param_3);

  }

  return;

}





// --- FUN_004313c0 at 0x004313C0 (size: 40) ---


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



{

  undefined4 *puVar1;

  int *piVar2;

  

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

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

    piVar2 = (int *)*puVar1;

    puVar1 = (undefined4 *)puVar1[1];

    (**(code **)(*piVar2 + 8))(param_2,param_3);

  }

  return;

}





// --- FUN_004313f0 at 0x004313F0 (size: 74) ---


void __thiscall FUN_004313f0(int param_1,undefined4 param_2)



{

  undefined4 *puVar1;

  int *piVar2;

  byte bVar3;

  

  *(char *)(param_1 + 0x1b) = (char)param_2;

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

    bVar3 = (*(char *)(param_1 + 0x1a) != '\0') + 1;

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

      bVar3 = bVar3 | 0x10;

    }

    else {

      bVar3 = bVar3 | 4;

    }

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

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

      piVar2 = (int *)*puVar1;

      puVar1 = (undefined4 *)puVar1[1];

      (**(code **)(*piVar2 + 0xc))(param_2,bVar3);

    }

  }

  return;

}





// --- FUN_00431440 at 0x00431440 (size: 58) ---


void __thiscall FUN_00431440(int param_1,int param_2)



{

  undefined4 *puVar1;

  undefined4 *puVar2;

  char cVar3;

  

  if (((*(int **)(param_2 + 0x40) == (int *)0x0) ||

      (cVar3 = (**(code **)(**(int **)(param_2 + 0x40) + 4))(param_2), cVar3 == '\0')) &&

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

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

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

      puVar2 = (undefined4 *)*puVar1;

      puVar1 = (undefined4 *)puVar1[1];

      (**(code **)*puVar2)(param_2);

    }

  }

  return;

}





// --- FUN_00431480 at 0x00431480 (size: 99) ---


uint __thiscall FUN_00431480(int param_1,void *param_2)



{

  int iVar1;

  undefined4 uVar2;

  

  uVar2 = 0;

  if ((param_2 == (void *)0x0) || (*(void **)(param_1 + 4) == (void *)0x0)) {

    return (uint)param_2 & 0xffffff00;

  }

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

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

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

    if (iVar1 == 0) {

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

      goto LAB_004314cd;

    }

  }

  else {

    *(undefined4 *)(*(int *)((int)param_2 + 0x10) + 0xc) = *(undefined4 *)((int)param_2 + 0xc);

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

    if (iVar1 == 0) {

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

      goto LAB_004314cd;

    }

    uVar2 = *(undefined4 *)((int)param_2 + 0x10);

  }

  *(undefined4 *)(iVar1 + 0x10) = uVar2;

LAB_004314cd:

  operator_delete(param_2);

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

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

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

}





// --- FUN_004314f0 at 0x004314F0 (size: 99) ---


uint __thiscall FUN_004314f0(int param_1,void *param_2)



{

  int iVar1;

  undefined4 uVar2;

  

  uVar2 = 0;

  if ((param_2 == (void *)0x0) || (*(void **)(param_1 + 4) == (void *)0x0)) {

    return (uint)param_2 & 0xffffff00;

  }

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

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

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

    if (iVar1 == 0) {

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

      goto LAB_0043153d;

    }

  }

  else {

    *(undefined4 *)(*(int *)((int)param_2 + 8) + 4) = *(undefined4 *)((int)param_2 + 4);

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

    if (iVar1 == 0) {

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

      goto LAB_0043153d;

    }

    uVar2 = *(undefined4 *)((int)param_2 + 8);

  }

  *(undefined4 *)(iVar1 + 8) = uVar2;

LAB_0043153d:

  operator_delete(param_2);

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

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

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

}





// --- FUN_004315c0 at 0x004315C0 (size: 237) ---


undefined4 __thiscall FUN_004315c0(int param_1,int param_2)



{

  undefined4 *puVar1;

  int iVar2;

  bool bVar3;

  uint uVar4;

  uint uVar5;

  int *piVar6;

  undefined4 uVar7;

  float local_10;

  uint local_c;

  undefined4 local_4;

  

  uVar5 = 0xffffffff;

  bVar3 = false;

  uVar4 = 0;

  local_c = 0xffffffff;

  local_10 = -2.0;

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

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

    bVar3 = false;

    do {

      if (*(int *)(param_2 + 8) == *piVar6) {

        bVar3 = true;

        uVar5 = uVar4;

      }

      else if (local_10 < ABS((float)piVar6[1])) {

        local_10 = ABS((float)piVar6[1]);

        local_c = uVar4;

      }

      uVar4 = uVar4 + 1;

      piVar6 = piVar6 + 2;

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

  }

  uVar7 = 2;

  if (bVar3) {

    if ((int)local_c < 0) {

      uVar7 = 3;

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

    }

    else if (local_10 < ABS(*(float *)(*(int *)(param_1 + 0x1c) + 4 + uVar5 * 8))) {

      *(float *)(param_2 + 0x14) = local_10;

      uVar7 = 1;

    }

    if (uVar5 < *(uint *)(param_1 + 0x24)) {

      uVar4 = *(uint *)(param_1 + 0x24) - 1;

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

      if (uVar5 != uVar4) {

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

        *(undefined4 *)(iVar2 + uVar5 * 8) = *(undefined4 *)(iVar2 + uVar4 * 8);

        *(undefined4 *)(iVar2 + 4 + uVar5 * 8) = *(undefined4 *)(iVar2 + 4 + uVar4 * 8);

        puVar1 = (undefined4 *)(*(int *)(param_1 + 0x1c) + *(int *)(param_1 + 0x24) * 8);

        *puVar1 = 0xffffffff;

        puVar1[1] = local_4;

      }

    }

  }

  return uVar7;

}





// --- FUN_004316b0 at 0x004316B0 (size: 63) ---


void __thiscall FUN_004316b0(int param_1,int param_2)



{

  int iVar1;

  

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

  if (iVar1 != 0) {

    while (*(int *)(param_2 + 8) < *(int *)(iVar1 + 8)) {

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

      if (iVar1 == 0) {

        FUN_00431250(param_2);

        return;

      }

    }

    if (iVar1 != 0) {

      FUN_004312c0(iVar1,param_2);

      return;

    }

  }

  FUN_00431250(param_2);

  return;

}





// --- FUN_004316f0 at 0x004316F0 (size: 58) ---


undefined4 __thiscall FUN_004316f0(int param_1,int *param_2)



{

  int *piVar1;

  

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

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

    do {

      if (((*piVar1 == *param_2) && (piVar1[1] == param_2[1])) && (piVar1[2] == param_2[2]))

      goto LAB_0043171d;

      piVar1 = (int *)piVar1[3];

    } while (piVar1 != (int *)0x0);

  }

  piVar1 = (int *)0x0;

LAB_0043171d:

  return CONCAT31((int3)((uint)piVar1 >> 8),piVar1 != (int *)0x0);

}





// --- FUN_00431730 at 0x00431730 (size: 52) ---


void __fastcall FUN_00431730(int param_1)



{

  void *pvVar1;

  int iVar2;

  

  while (pvVar1 = *(void **)(param_1 + 4), pvVar1 != (void *)0x0) {

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

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

    if (iVar2 == 0) {

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

    }

    else {

      *(undefined4 *)(iVar2 + 0x10) = 0;

    }

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

      operator_delete(pvVar1);

    }

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

  }

  return;

}





// --- FUN_00431870 at 0x00431870 (size: 62) ---


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



{

  int *piVar1;

  undefined4 uVar2;

  int *piVar3;

  

  uVar2 = 0;

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

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

    if ((*piVar3 == param_2) && (piVar3[1] == param_3)) {

      piVar1 = (int *)piVar3[3];

      FUN_00431480(piVar3);

      uVar2 = 1;

      piVar3 = piVar1;

    }

    else {

      piVar3 = (int *)piVar3[3];

    }

  }

  return uVar2;

}





// --- FUN_004319b0 at 0x004319B0 (size: 305) ---


void FUN_004319b0(void)



{

  LONG LVar1;

  undefined4 *puVar2;

  int local_4;

  

  FUN_00401340("Mouse sensitivity when user is in mouse look mode.");

  FUN_00431090(&DAT_0083804c,&local_4,0,0,0,0);

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

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

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

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

  }

  FUN_00401340("Mouse look smoothing amount.");

  FUN_00431090(&DAT_00838050,&local_4,0,0,0,0);

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

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

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

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

  }

  FUN_00401340("Invert mouse look vertical rotation?");

  FUN_00411d90(&DAT_00838054,&local_4,0,0,0,0);

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

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

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

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

  }

  FUN_00401340("Turn your character with the camera turn button?");

  FUN_00411d90(&DAT_00838058,&local_4,0,0,0,0);

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

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

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

  }

  return;

}





// --- FUN_00431af0 at 0x00431AF0 (size: 52) ---


undefined4 __thiscall FUN_00431af0(int param_1,uint param_2)



{

  uint *puVar1;

  bool bVar2;

  

  puVar1 = *(uint **)(*(int *)(param_1 + 0xf0) + (param_2 % *(uint *)(param_1 + 0xf8)) * 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_00431b30 at 0x00431B30 (size: 74) ---


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



{

  undefined4 *puVar1;

  undefined4 uVar2;

  

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

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

    uVar2 = FUN_00431110(uVar2);

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

      return uVar2;

    }

  }

  puVar1 = (undefined4 *)(*param_1 + param_1[2] * 8);

  *puVar1 = *param_2;

  puVar1[1] = param_2[1];

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

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

}





// --- FUN_00431b80 at 0x00431B80 (size: 36) ---


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



{

  *param_1 = &PTR_FUN_00799318;

  FUN_0049f850();

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

    operator_delete(param_1);

  }

  return param_1;

}





// --- FUN_00431bb0 at 0x00431BB0 (size: 36) ---


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



{

  *param_1 = &PTR_FUN_0079931c;

  FUN_00431730();

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

    operator_delete(param_1);

  }

  return param_1;

}





// --- FUN_00431be0 at 0x00431BE0 (size: 228) ---


void __fastcall FUN_00431be0(undefined4 *param_1)



{

  *param_1 = &PTR_FUN_007993e8;

  thunk_FUN_00436cf0(&DAT_0083804c);

  thunk_FUN_00436cf0(&DAT_00838050);

  thunk_FUN_00436cf0(&DAT_00838054);

  thunk_FUN_00436cf0(&DAT_00838058);

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

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

    param_1[0x23] = 0;

  }

  param_1[0x24] = &PTR_FUN_00799330;

  if ((undefined4 *)param_1[0x3c] != param_1 + 0x25) {

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

  }

  param_1[0x3c] = 0;

  param_1[0x3d] = 0;

  param_1[0x3e] = 0;

  param_1[0x3f] = 0;

  param_1[0x1b] = &PTR_FUN_0079931c;

  FUN_00431730();

  param_1[0x17] = &PTR_FUN_00799318;

  FUN_0049f850();

  param_1[0x13] = &PTR_FUN_00799318;

  FUN_0049f850();

  param_1[0xf] = &PTR_FUN_00799318;

  FUN_0049f850();

  param_1[0xb] = &PTR_FUN_00799318;

  FUN_0049f850();

  param_1[7] = &PTR_FUN_00799318;

  FUN_0049f850();

  *param_1 = &PTR_LAB_00799268;

  return;

}





// --- FUN_00431d60 at 0x00431D60 (size: 576) ---


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

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



void __fastcall FUN_00431d60(int *param_1)



{

  uint uVar1;

  undefined4 uVar2;

  undefined4 uVar3;

  char cVar4;

  undefined4 uVar5;

  int iVar6;

  uint uVar7;

  uint *puVar8;

  float10 fVar9;

  int local_b4;

  int local_a4;

  undefined4 *local_a0;

  undefined4 *local_9c;

  uint local_98;

  undefined4 local_94;

  undefined4 local_90;

  undefined4 local_8c;

  undefined4 local_88;

  float local_84;

  undefined4 local_80;

  undefined4 local_7c;

  undefined1 local_78;

  uint local_70;

  uint local_6c;

  undefined4 local_68;

  uint local_64;

  uint local_58;

  undefined1 local_50 [32];

  undefined1 local_30;

  int local_20;

  

  uVar3 = DAT_008379ac;

  uVar2 = DAT_008379a8;

  local_b4 = 0;

  FUN_004180a0(param_1[0x3f]);

  FUN_0052dcf0(&local_a4);

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

    do {

      if ((3 < (uint)local_9c[5]) && ((uint)local_9c[5] < 6)) {

        uVar5 = FUN_00453850(1);

        cVar4 = FUN_004180a0(uVar5);

        if (cVar4 != '\0') {

          *(undefined4 *)(local_b4 * 4) = *local_9c;

          local_b4 = local_b4 + 1;

        }

      }

      local_9c = (undefined4 *)local_9c[1];

    } while (local_9c != (undefined4 *)0x0);

    do {

      local_a0 = local_a0 + 1;

      if (local_a0 == (undefined4 *)(*(int *)(local_a4 + 0x60) + *(int *)(local_a4 + 0x68) * 4))

      goto joined_r0x00431e39;

      local_9c = (undefined4 *)*local_a0;

    } while (local_9c == (undefined4 *)0x0);

  }

joined_r0x00431e39:

  do {

    do {

      if (local_b4 == 0) {

        return;

      }

      uVar1 = *(uint *)(local_b4 * 4 + -4);

      local_b4 = local_b4 + -1;

      puVar8 = *(uint **)(param_1[0x3c] + (uVar1 % (uint)param_1[0x3e]) * 4);

    } while (puVar8 == (uint *)0x0);

    do {

      if (*puVar8 == uVar1) {

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

          if (puVar8[5] == 4) {

            if (_DAT_00818a78 + *(double *)(puVar8 + 2) <= (double)CONCAT44(uVar3,uVar2)) {

              iVar6 = FUN_005df4c4();

              uVar1 = puVar8[4];

              uVar7 = iVar6 + 1;

              if (uVar1 < uVar7) {

                puVar8[4] = uVar7;

                FUN_00430ff0(puVar8);

                local_30 = 1;

                local_20 = uVar7 - uVar1;

                (**(code **)(*param_1 + 0xb8))(local_50);

              }

            }

          }

          else if (puVar8[5] == 5) {

            uVar1 = puVar8[4];

            local_98 = *puVar8;

            puVar8[4] = uVar1 + 1;

            local_94 = 0;

            local_90 = 0xffffffff;

            local_8c = 0;

            local_88 = 0;

            fVar9 = (float10)FUN_00430f90();

            local_84 = (float)fVar9;

            local_6c = puVar8[3];

            local_70 = puVar8[2];

            local_58 = puVar8[6];

            local_80 = 0;

            local_7c = 5;

            local_68 = 1;

            local_78 = 1;

            local_64 = uVar1 + 1;

            (**(code **)(*param_1 + 0xb8))(&local_98);

          }

        }

        break;

      }

      puVar8 = (uint *)puVar8[1];

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

  } while( true );

}





// --- FUN_00431fa0 at 0x00431FA0 (size: 290) ---


undefined4 __thiscall FUN_00431fa0(int param_1,int param_2)



{

  int *piVar1;

  undefined4 *puVar2;

  float fVar3;

  bool bVar4;

  char cVar5;

  undefined4 uVar6;

  undefined4 uVar7;

  uint uVar8;

  float local_10;

  undefined4 local_c;

  undefined4 local_4;

  

  uVar7 = DAT_008379a8;

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

    *(undefined4 *)(param_2 + 0x2c) = DAT_008379ac;

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

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

    *(undefined4 *)(param_1 + 0xc) = *(undefined4 *)(param_2 + 0x2c);

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

    local_c = *(undefined4 *)(param_2 + 0x14);

    local_10 = *(float *)(param_2 + 8);

    FUN_00431b30(&local_10);

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

    return 0;

  }

  bVar4 = false;

  uVar8 = 0;

  local_10 = -2.0;

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

    do {

      piVar1 = (int *)(*(int *)(param_1 + 0x1c) + uVar8 * 8);

      fVar3 = ABS(*(float *)(*(int *)(param_1 + 0x1c) + 4 + uVar8 * 8));

      if (local_10 < fVar3) {

        local_10 = fVar3;

      }

      if (*(int *)(param_2 + 8) == *piVar1) {

        if ((float)piVar1[1] != *(float *)(param_2 + 0x14)) {

          piVar1[1] = *(int *)(param_2 + 0x14);

        }

        bVar4 = true;

      }

      uVar8 = uVar8 + 1;

    } while (uVar8 < *(uint *)(param_1 + 0x24));

    if (bVar4) goto LAB_0043209d;

  }

  local_4 = *(undefined4 *)(param_2 + 0x14);

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

  uVar8 = *(uint *)(param_1 + 0x20) & 0x7fffffff;

  if (uVar8 <= *(uint *)(param_1 + 0x24)) {

    uVar6 = FUN_00453850(uVar8 + 1);

    cVar5 = FUN_00431110(uVar6);

    if (cVar5 == '\0') goto LAB_0043209d;

  }

  puVar2 = (undefined4 *)(*(int *)(param_1 + 0x1c) + *(int *)(param_1 + 0x24) * 8);

  *puVar2 = uVar7;

  puVar2[1] = local_4;

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

LAB_0043209d:

  uVar7 = 1;

  if (ABS(*(float *)(param_2 + 0x14)) <= local_10) {

    uVar7 = 2;

  }

  return uVar7;

}





// --- FUN_004320d0 at 0x004320D0 (size: 73) ---


void __fastcall FUN_004320d0(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_004322f0(*puVar2);

  return;

}





// --- FUN_00432120 at 0x00432120 (size: 30) ---


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



{

  FUN_00431be0();

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

    operator_delete(param_1);

  }

  return param_1;

}





// --- FUN_00432260 at 0x00432260 (size: 143) ---


undefined4 * __thiscall FUN_00432260(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_00799330;

  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_004322f0 at 0x004322F0 (size: 310) ---


undefined4 __thiscall FUN_004322f0(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_004322f0(*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_0043233f;

      }

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

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

    }

    puVar11 = (uint *)0x0;

    puVar9 = (uint *)0x0;

LAB_0043233f:

    puVar7 = (uint *)*puVar11;

    if (puVar7 == puVar9) {

LAB_00432352:

      *puVar11 = puVar7[1];

    }

    else {

      do {

        puVar6 = puVar7;

        puVar7 = (uint *)puVar6[1];

      } while (puVar7 != puVar9);

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

      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_00432430 at 0x00432430 (size: 360) ---


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



undefined4 * __fastcall FUN_00432430(undefined4 *param_1)



{

  double dVar1;

  BOOL BVar2;

  uint local_8 [2];

  

  *param_1 = &PTR_FUN_007993e8;

  param_1[4] = 0;

  param_1[5] = 0;

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

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

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

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

  param_1[8] = 0;

  param_1[9] = 0;

  param_1[10] = 0;

  param_1[7] = &PTR_FUN_00799318;

  param_1[0xb] = &PTR_FUN_00799318;

  param_1[0xc] = 0;

  param_1[0xd] = 0;

  param_1[0xe] = 0;

  param_1[0xf] = &PTR_FUN_00799318;

  param_1[0x10] = 0;

  param_1[0x11] = 0;

  param_1[0x12] = 0;

  param_1[0x13] = &PTR_FUN_00799318;

  param_1[0x14] = 0;

  param_1[0x15] = 0;

  param_1[0x16] = 0;

  param_1[0x17] = &PTR_FUN_00799318;

  param_1[0x18] = 0;

  param_1[0x19] = 0;

  param_1[0x1a] = 0;

  param_1[0x1b] = &PTR_FUN_0079931c;

  param_1[0x1c] = 0;

  param_1[0x1d] = 0;

  param_1[0x1e] = 0;

  param_1[0x1f] = 0;

  param_1[0x20] = 0x3e800000;

  param_1[0x21] = 0;

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

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

  param_1[0x23] = 0;

  FUN_00432260(10);

  FUN_004319b0();

  BVar2 = SystemParametersInfoA(0x16,0,local_8,0);

  if (BVar2 != 0) {

    dVar1 = (double)(int)local_8[0];

    if ((int)local_8[0] < 0) {

      dVar1 = dVar1 + _DAT_00795518;

    }

    _DAT_00818a78 = (dVar1 + _DAT_007938c0) * _DAT_007994a8;

  }

  BVar2 = SystemParametersInfoA(10,0,local_8,0);

  if (BVar2 != 0) {

    if (0x1f < local_8[0]) {

      _DAT_00818a80 = 0.03333333333333333;

      return param_1;

    }

    if (local_8[0] != 0) {

      dVar1 = (double)(int)local_8[0];

      if ((int)local_8[0] < 0) {

        dVar1 = dVar1 + _DAT_00795518;

      }

      _DAT_00818a80 = _DAT_00799320 - dVar1 * _DAT_00799328;

      return param_1;

    }

    _DAT_00818a80 = 0.4;

  }

  return param_1;

}





// --- FUN_004325a0 at 0x004325A0 (size: 120) ---


uint __thiscall FUN_004325a0(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_004325cb:

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

        FUN_004320d0();

      }

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

    }

    puVar1 = (uint *)puVar1[1];

  } while( true );

}





// --- FUN_00432620 at 0x00432620 (size: 169) ---


void __thiscall FUN_00432620(int *param_1,undefined4 *param_2)



{

  void *pvVar1;

  undefined4 *puVar2;

  

  pvVar1 = (void *)FUN_004171e0(param_2);

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

    *(undefined1 *)(param_2 + 8) = 0;

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

    if ((*(uint *)((int)pvVar1 + 0x20) & 0x80000000) == 0x80000000) {

      operator_delete__(*(void **)((int)pvVar1 + 0x1c));

    }

    operator_delete(pvVar1);

    return;

  }

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

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

    puVar2 = (undefined4 *)0x0;

  }

  else {

    *puVar2 = *param_2;

    puVar2[1] = 0;

    puVar2[2] = 0;

    puVar2[3] = 0;

    puVar2[4] = 0;

    puVar2[6] = 0;

    puVar2[7] = 0;

    puVar2[8] = 0;

    puVar2[9] = 0;

  }

  FUN_004325a0(puVar2);

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

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

  return;

}





// --- FUN_004326d0 at 0x004326D0 (size: 161) ---


void __thiscall FUN_004326d0(int *param_1,uint *param_2)



{

  int iVar1;

  uint *puVar2;

  

  puVar2 = *(uint **)(param_1[0x3c] + (*param_2 % (uint)param_1[0x3e]) * 4);

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

    while (*puVar2 != *param_2) {

      puVar2 = (uint *)puVar2[1];

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

        return;

      }

    }

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

      iVar1 = FUN_004315c0(param_2);

      if (iVar1 == 1) {

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

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

      }

      else if (iVar1 == 3) {

        FUN_004171e0(param_2);

        *(undefined1 *)(param_2 + 8) = 0;

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

        if ((puVar2[8] & 0x80000000) == 0x80000000) {

          operator_delete__((void *)puVar2[7]);

        }

        operator_delete(puVar2);

        return;

      }

    }

  }

  return;

}





// --- FUN_00432780 at 0x00432780 (size: 111) ---


void __fastcall FUN_00432780(int *param_1)



{

  void *pvVar1;

  undefined1 local_48 [20];

  undefined4 local_34;

  undefined1 local_28;

  

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

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

    FUN_00430ff0(pvVar1);

    local_34 = 0;

    local_28 = 0;

    (**(code **)(*param_1 + 0xb8))(local_48);

    if ((*(uint *)((int)pvVar1 + 0x20) & 0x80000000) == 0x80000000) {

      operator_delete__(*(void **)((int)pvVar1 + 0x1c));

    }

    operator_delete(pvVar1);

  }

  return;

}





// --- FUN_004327f0 at 0x004327F0 (size: 192) ---


void __thiscall FUN_004327f0(int *param_1,uint *param_2)



{

  uint uVar1;

  uint *puVar2;

  int iVar3;

  

  for (puVar2 = *(uint **)(param_1[0x3c] + (*param_2 % (uint)param_1[0x3e]) * 4);

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

  }

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

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

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

      puVar2 = (uint *)0x0;

    }

    else {

      *puVar2 = *param_2;

      puVar2[1] = 0;

      puVar2[2] = 0;

      puVar2[3] = 0;

      puVar2[4] = 0;

      puVar2[6] = 0;

      puVar2[7] = 0;

      puVar2[8] = 0;

      puVar2[9] = 0;

    }

    FUN_004325a0(puVar2);

  }

  iVar3 = FUN_00431fa0(param_2);

  if (iVar3 == 0) {

    uVar1 = *param_2;

    if (((uVar1 == 0x29) || (uVar1 == 0x2a)) || (uVar1 == 0x2b)) {

      FUN_00432780();

    }

  }

  else if (iVar3 != 1) {

    return;

  }

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

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

  return;

}





// --- FUN_004328c0 at 0x004328C0 (size: 174) ---


void __thiscall FUN_004328c0(int param_1,undefined4 *param_2)



{

  uint uVar1;

  int iVar2;

  

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

    iVar2 = FUN_006863a0(*param_2,param_2[1]);

    param_2[7] = iVar2;

    if (iVar2 == 0) {

      param_2[7] = 3;

    }

    uVar1 = param_2[7];

    if ((float)param_2[5] == DAT_00796344) {

      if ((uVar1 == 1) || ((3 < uVar1 && (uVar1 < 6)))) {

        FUN_004326d0(param_2);

        return;

      }

    }

    else {

      switch(uVar1) {

      case 1:

        FUN_004327f0(param_2);

        if ((*(byte *)(param_2 + 4) & 0xa9) == 0) {

          FUN_004326d0(param_2);

          return;

        }

        break;

      case 2:

        FUN_00432620(param_2);

        return;

      case 3:

        FUN_00430ec0(param_2);

        return;

      default:

        FUN_004327f0(param_2);

      }

    }

  }

  return;

}





// --- FUN_00432a50 at 0x00432A50 (size: 64) ---


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



{

  *param_1 = &PTR_FUN_007994f4;

  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_00432a90 at 0x00432A90 (size: 64) ---


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



{

  *param_1 = &PTR_FUN_007994f8;

  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_00432ad0 at 0x00432AD0 (size: 87) ---


undefined4 FUN_00432ad0(undefined4 *param_1,undefined4 *param_2)



{

  byte bVar1;

  byte *pbVar2;

  int iVar3;

  byte *pbVar4;

  bool bVar5;

  

  pbVar4 = (byte *)*param_2;

  pbVar2 = (byte *)*param_1;

  while( true ) {

    bVar1 = *pbVar2;

    bVar5 = bVar1 < *pbVar4;

    if (bVar1 != *pbVar4) break;

    if (bVar1 == 0) {

      return 0;

    }

    bVar1 = pbVar2[1];

    bVar5 = bVar1 < pbVar4[1];

    if (bVar1 != pbVar4[1]) break;

    pbVar2 = pbVar2 + 2;

    pbVar4 = pbVar4 + 2;

    if (bVar1 == 0) {

      return 0;

    }

  }

  iVar3 = (1 - (uint)bVar5) - (uint)(bVar5 != 0);

  return CONCAT31((int3)((uint)iVar3 >> 8),iVar3 < 0);

}





// --- FUN_00432b30 at 0x00432B30 (size: 78) ---


void __thiscall FUN_00432b30(int param_1,int *param_2)



{

  int iVar1;

  uint uVar2;

  uint uVar3;

  

  iVar1 = *param_2;

  uVar3 = *(uint *)(iVar1 + -8);

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

  if (uVar3 == 0xffffffff) {

    uVar3 = FUN_004016b0(iVar1);

    *(uint *)(iVar1 + -8) = uVar3;

  }

  uVar3 = uVar3 % uVar2;

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

  param_2[1] = *(int *)(iVar1 + uVar3 * 4);

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

  uVar3 = iVar1 + uVar3 * 4;

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

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

  }

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

  return;

}





// --- FUN_00432b80 at 0x00432B80 (size: 92) ---


void __thiscall FUN_00432b80(int param_1,undefined1 *param_2)



{

  LONG LVar1;

  undefined4 *puVar2;

  

  if ((*(int *)(param_1 + 0x10) == 2) &&

     (**(undefined1 **)(param_1 + 0xc) = *param_2, *(int *)(param_1 + 0x14) != 0)) {

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

    InterlockedIncrement((LONG *)((int)param_2 + -0x10));

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

    puVar2 = (undefined4 *)((int)param_2 + -0x14);

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

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

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

    }

  }

  return;

}





// --- FUN_00432be0 at 0x00432BE0 (size: 146) ---


undefined4 * FUN_00432be0(undefined4 *param_1,undefined4 *param_2,undefined4 *param_3)



{

  byte bVar1;

  char cVar2;

  byte *pbVar3;

  int iVar4;

  byte *pbVar5;

  bool bVar6;

  

  pbVar3 = (byte *)*param_1;

  pbVar5 = (byte *)*param_2;

  do {

    bVar1 = *pbVar3;

    bVar6 = bVar1 < *pbVar5;

    if (bVar1 != *pbVar5) {

LAB_00432c19:

      iVar4 = (1 - (uint)bVar6) - (uint)(bVar6 != 0);

      goto LAB_00432c1e;

    }

    if (bVar1 == 0) break;

    bVar1 = pbVar3[1];

    bVar6 = bVar1 < pbVar5[1];

    if (bVar1 != pbVar5[1]) goto LAB_00432c19;

    pbVar3 = pbVar3 + 2;

    pbVar5 = pbVar5 + 2;

  } while (bVar1 != 0);

  iVar4 = 0;

LAB_00432c1e:

  if (iVar4 < 0) {

    cVar2 = FUN_00432ad0(param_2,param_3);

    if (cVar2 == '\0') {

      cVar2 = FUN_00432ad0(param_1,param_3);

      if (cVar2 == '\0') {

        return param_1;

      }

      return param_3;

    }

  }

  else {

    cVar2 = FUN_00432ad0(param_1,param_3);

    if (cVar2 != '\0') {

      return param_1;

    }

    cVar2 = FUN_00432ad0(param_2,param_3);

    if (cVar2 != '\0') {

      return param_3;

    }

  }

  return param_2;

}





// --- FUN_00432c80 at 0x00432C80 (size: 155) ---


void FUN_00432c80(int *param_1,int *param_2)



{

  int iVar1;

  int iVar2;

  LONG LVar3;

  

  iVar1 = *param_1;

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

  iVar2 = *param_1;

  if (iVar2 != *param_2) {

    LVar3 = InterlockedDecrement((LONG *)(iVar2 + -0x10));

    if ((LVar3 == 0) && ((undefined4 *)(iVar2 + -0x14) != (undefined4 *)0x0)) {

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

    }

    iVar2 = *param_2;

    *param_1 = iVar2;

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

  }

  iVar2 = *param_2;

  if (iVar2 != iVar1) {

    LVar3 = InterlockedDecrement((LONG *)(iVar2 + -0x10));

    if ((LVar3 == 0) && ((undefined4 *)(iVar2 + -0x14) != (undefined4 *)0x0)) {

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

    }

    *param_2 = iVar1;

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

  }

  LVar3 = InterlockedDecrement((LONG *)(iVar1 + -0x10));

  if ((LVar3 == 0) && ((undefined4 *)(iVar1 + -0x14) != (undefined4 *)0x0)) {

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

  }

  return;

}





// --- FUN_00432d20 at 0x00432D20 (size: 258) ---


void FUN_00432d20(int *param_1,byte *param_2)



{

  byte bVar1;

  byte *pbVar2;

  byte *pbVar3;

  int iVar4;

  LONG LVar5;

  byte *pbVar6;

  int *piVar7;

  bool bVar8;

  

  pbVar2 = (byte *)param_1[-1];

  pbVar3 = param_2;

  pbVar6 = pbVar2;

  do {

    bVar1 = *pbVar3;

    bVar8 = bVar1 < *pbVar6;

    if (bVar1 != *pbVar6) {

LAB_00432d58:

      iVar4 = (1 - (uint)bVar8) - (uint)(bVar8 != 0);

      goto joined_r0x00432d5f;

    }

    if (bVar1 == 0) break;

    bVar1 = pbVar3[1];

    bVar8 = bVar1 < pbVar6[1];

    if (bVar1 != pbVar6[1]) goto LAB_00432d58;

    pbVar3 = pbVar3 + 2;

    pbVar6 = pbVar6 + 2;

  } while (bVar1 != 0);

  iVar4 = 0;

joined_r0x00432d5f:

  do {

    if (-1 < iVar4) {

      pbVar2 = (byte *)*param_1;

      if (pbVar2 != param_2) {

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

        if ((LVar5 == 0) && (pbVar2 + -0x14 != (byte *)0x0)) {

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

        }

        *param_1 = (int)param_2;

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

      }

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

      if ((LVar5 == 0) && (param_2 + -0x14 != (byte *)0x0)) {

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

      }

      return;

    }

    piVar7 = param_1 + -1;

    pbVar3 = (byte *)*param_1;

    if (pbVar3 != pbVar2) {

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

      if ((LVar5 == 0) && (pbVar3 + -0x14 != (byte *)0x0)) {

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

      }

      *param_1 = *piVar7;

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

    }

    pbVar2 = (byte *)param_1[-2];

    pbVar3 = param_2;

    pbVar6 = pbVar2;

    do {

      bVar1 = *pbVar3;

      bVar8 = bVar1 < *pbVar6;

      param_1 = piVar7;

      if (bVar1 != *pbVar6) {

LAB_00432dc4:

        iVar4 = (1 - (uint)bVar8) - (uint)(bVar8 != 0);

        goto joined_r0x00432d5f;

      }

      if (bVar1 == 0) break;

      bVar1 = pbVar3[1];

      bVar8 = bVar1 < pbVar6[1];

      if (bVar1 != pbVar6[1]) goto LAB_00432dc4;

      pbVar3 = pbVar3 + 2;

      pbVar6 = pbVar6 + 2;

    } while (bVar1 != 0);

    iVar4 = 0;

  } while( true );

}





// --- FUN_00432e30 at 0x00432E30 (size: 242) ---


void FUN_00432e30(int param_1,int param_2,int param_3,byte *param_4)



{

  byte bVar1;

  int iVar2;

  byte *pbVar3;

  int iVar4;

  LONG LVar5;

  byte *pbVar6;

  bool bVar7;

  

  while (iVar2 = param_2, param_3 < iVar2) {

    param_2 = (iVar2 + -1) / 2;

    pbVar3 = *(byte **)(param_1 + param_2 * 4);

    pbVar6 = param_4;

    do {

      bVar1 = *pbVar3;

      bVar7 = bVar1 < *pbVar6;

      if (bVar1 != *pbVar6) {

LAB_00432e7b:

        iVar4 = (1 - (uint)bVar7) - (uint)(bVar7 != 0);

        goto LAB_00432e80;

      }

      if (bVar1 == 0) break;

      bVar1 = pbVar3[1];

      bVar7 = bVar1 < pbVar6[1];

      if (bVar1 != pbVar6[1]) goto LAB_00432e7b;

      pbVar3 = pbVar3 + 2;

      pbVar6 = pbVar6 + 2;

    } while (bVar1 != 0);

    iVar4 = 0;

LAB_00432e80:

    if (-1 < iVar4) break;

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

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

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

      if ((LVar5 == 0) && ((undefined4 *)(iVar4 + -0x14) != (undefined4 *)0x0)) {

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

      }

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

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

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

    }

  }

  pbVar3 = *(byte **)(param_1 + iVar2 * 4);

  if (pbVar3 != param_4) {

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

    if ((LVar5 == 0) && (pbVar3 + -0x14 != (byte *)0x0)) {

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

    }

    *(byte **)(param_1 + iVar2 * 4) = param_4;

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

  }

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

  if ((LVar5 == 0) && (param_4 + -0x14 != (byte *)0x0)) {

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

  }

  return;

}





// --- FUN_00432f30 at 0x00432F30 (size: 112) ---


int * FUN_00432f30(int param_1,int *param_2,int *param_3)



{

  int iVar1;

  LONG LVar2;

  int *piVar3;

  

  iVar1 = (int)param_2 - param_1 >> 2;

  piVar3 = param_2;

  param_2 = (int *)iVar1;

  if (iVar1 < 1) {

    return param_3;

  }

  do {

    iVar1 = param_3[-1];

    param_3 = param_3 + -1;

    if (iVar1 != piVar3[-1]) {

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

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

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

      }

      iVar1 = piVar3[-1];

      *param_3 = iVar1;

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

    }

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

    piVar3 = piVar3 + -1;

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

  return param_3;

}





// --- FUN_00432fa0 at 0x00432FA0 (size: 19) ---


undefined4 __fastcall FUN_00432fa0(int param_1)



{

  int iVar1;

  int *piVar2;

  int iVar3;

  int iVar4;

  undefined1 auStack_c [12];

  

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

    return 0;

  }

  piVar2 = (int *)FUN_0052dcf0(auStack_c);

  iVar4 = piVar2[2];

  iVar1 = *piVar2;

  piVar2 = (int *)piVar2[1];

  do {

    if (iVar4 == 0) {

      return 1;

    }

    do {

      iVar3 = (**(code **)(**(int **)(iVar4 + 8) + 0x3c))();

      if (iVar3 == 0) {

        return 0;

      }

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

    } while (iVar4 != 0);

    do {

      piVar2 = piVar2 + 1;

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

        return 1;

      }

      iVar4 = *piVar2;

    } while (iVar4 == 0);

  } while( true );

}





// --- FUN_00432fb3 at 0x00432FB3 (size: 98) ---


undefined4 FUN_00432fb3(void)



{

  int iVar1;

  int *piVar2;

  int iVar3;

  int iVar4;

  

  piVar2 = (int *)FUN_0052dcf0(&stack0x00000000);

  iVar4 = piVar2[2];

  iVar1 = *piVar2;

  piVar2 = (int *)piVar2[1];

  do {

    if (iVar4 == 0) {

      return 1;

    }

    do {

      iVar3 = (**(code **)(**(int **)(iVar4 + 8) + 0x3c))();

      if (iVar3 == 0) {

        return 0;

      }

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

    } while (iVar4 != 0);

    do {

      piVar2 = piVar2 + 1;

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

        return 1;

      }

      iVar4 = *piVar2;

    } while (iVar4 == 0);

  } while( true );

}





// --- FUN_00433020 at 0x00433020 (size: 218) ---


void __fastcall FUN_00433020(int param_1)



{

  int *piVar1;

  int *piVar2;

  int iVar3;

  int iVar4;

  undefined1 local_c [12];

  

  piVar1 = (int *)FUN_0052dcf0(local_c);

  piVar2 = (int *)piVar1[1];

  iVar4 = piVar1[2];

  while (iVar4 != 0) {

    do {

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

    } while (iVar4 != 0);

    do {

      piVar2 = piVar2 + 1;

      if (piVar2 == (int *)(*(int *)(*piVar1 + 0x60) + *(int *)(*piVar1 + 0x68) * 4))

      goto LAB_00433067;

      iVar4 = *piVar2;

    } while (iVar4 == 0);

  }

LAB_00433067:

  piVar2 = *(int **)(param_1 + 33000);

  do {

    if (piVar2 == (int *)(*(int *)(param_1 + 0x80e4) + *(int *)(param_1 + 0x80ec) * 4)) {

      piVar2 = (int *)0x0;

      iVar4 = 0;

joined_r0x004330aa:

      do {

        if (iVar4 == 0) {

          return;

        }

        do {

          iVar3 = (**(code **)(**(int **)(iVar4 + 8) + 0x3c))();

          if (iVar3 == 0) {

            (**(code **)(**(int **)(iVar4 + 8) + 0x34))();

          }

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

        } while (iVar4 != 0);

        do {

          piVar2 = piVar2 + 1;

          if (piVar2 == (int *)(*(int *)(param_1 + 0x80e4) + *(int *)(param_1 + 0x80ec) * 4)) {

            return;

          }

          iVar4 = *piVar2;

        } while (iVar4 == 0);

      } while( true );

    }

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

      piVar2 = *(int **)(param_1 + 33000);

      iVar4 = *piVar2;

      goto joined_r0x004330aa;

    }

    piVar2 = *(int **)(param_1 + 33000) + 1;

    *(int **)(param_1 + 33000) = piVar2;

  } while( true );

}





// --- FUN_00433100 at 0x00433100 (size: 91) ---


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



{

  int iVar1;

  uint uVar2;

  int iVar3;

  char cVar4;

  uint uVar5;

  

  iVar1 = *param_3;

  uVar5 = *(uint *)(iVar1 + -8);

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

  if (uVar5 == 0xffffffff) {

    uVar5 = FUN_004016b0(iVar1);

    *(uint *)(iVar1 + -8) = uVar5;

  }

  uVar5 = uVar5 % uVar2;

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

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

  while ((iVar3 != 0 && (cVar4 = FUN_00401920(param_3), cVar4 == '\0'))) {

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

  }

  *param_2 = param_1;

  param_2[2] = iVar3;

  param_2[1] = iVar1 + uVar5 * 4;

  return;

}





// --- FUN_00433160 at 0x00433160 (size: 67) ---


void FUN_00433160(int *param_1,int *param_2,undefined4 param_3,undefined4 param_4)



{

  int iVar1;

  undefined4 uVar2;

  

  for (; param_1 != param_2; param_1 = param_1 + 1) {

    iVar1 = *param_1;

    uVar2 = param_4;

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

    FUN_00432d20(param_1,iVar1,uVar2);

  }

  return;

}





// --- FUN_004331b0 at 0x004331B0 (size: 294) ---


void FUN_004331b0(int param_1,int param_2,int param_3,int param_4,undefined4 param_5)



{

  byte bVar1;

  int iVar2;

  byte *pbVar3;

  int iVar4;

  LONG LVar5;

  int iVar6;

  int iVar7;

  byte *pbVar8;

  bool bVar9;

  

  iVar7 = param_2;

  do {

    iVar6 = iVar7;

    iVar2 = iVar6 * 2;

    iVar7 = iVar2 + 2;

    if (param_3 <= iVar7) {

      if (iVar7 == param_3) {

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

        if (iVar4 != *(int *)(param_1 + -4 + iVar7 * 4)) {

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

          if ((LVar5 == 0) && ((undefined4 *)(iVar4 + -0x14) != (undefined4 *)0x0)) {

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

          }

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

          *(int *)(param_1 + iVar6 * 4) = iVar7;

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

        }

        iVar6 = iVar2 + 1;

      }

      iVar7 = param_4;

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

      FUN_00432e30(param_1,iVar6,param_2,iVar7,param_5);

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

      if ((LVar5 == 0) && ((undefined4 *)(param_4 + -0x14) != (undefined4 *)0x0)) {

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

      }

      return;

    }

    pbVar8 = *(byte **)(param_1 + -4 + iVar7 * 4);

    pbVar3 = *(byte **)(param_1 + iVar7 * 4);

    do {

      bVar1 = *pbVar3;

      bVar9 = bVar1 < *pbVar8;

      if (bVar1 != *pbVar8) {

LAB_004331fc:

        iVar4 = (1 - (uint)bVar9) - (uint)(bVar9 != 0);

        goto LAB_00433201;

      }

      if (bVar1 == 0) break;

      bVar1 = pbVar3[1];

      bVar9 = bVar1 < pbVar8[1];

      if (bVar1 != pbVar8[1]) goto LAB_004331fc;

      pbVar3 = pbVar3 + 2;

      pbVar8 = pbVar8 + 2;

    } while (bVar1 != 0);

    iVar4 = 0;

LAB_00433201:

    if (iVar4 < 0) {

      iVar7 = iVar2 + 1;

    }

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

    if (iVar2 != *(int *)(param_1 + iVar7 * 4)) {

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

      if ((LVar5 == 0) && ((undefined4 *)(iVar2 + -0x14) != (undefined4 *)0x0)) {

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

      }

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

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

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

    }

  } while( true );

}





// --- FUN_004332e0 at 0x004332E0 (size: 355) ---


void __fastcall FUN_004332e0(undefined4 *param_1)



{

  LONG LVar1;

  undefined4 *puVar2;

  undefined4 *local_4;

  

  *param_1 = &PTR_LAB_00799534;

  local_4 = param_1;

  FUN_00401340("Toggle");

  FUN_00436830(&local_4);

  puVar2 = local_4 + -5;

  LVar1 = InterlockedDecrement(local_4 + -4);

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

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

  }

  FUN_00401340(&DAT_00799528);

  FUN_00436830(&local_4);

  puVar2 = local_4 + -5;

  LVar1 = InterlockedDecrement(local_4 + -4);

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

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

  }

  FUN_00401340(&DAT_00799520);

  FUN_00436830(&local_4);

  puVar2 = local_4 + -5;

  LVar1 = InterlockedDecrement(local_4 + -4);

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

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

  }

  FUN_00401340(&DAT_00799518);

  FUN_00436830(&local_4);

  puVar2 = local_4 + -5;

  LVar1 = InterlockedDecrement(local_4 + -4);

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

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

  }

  FUN_00401340("ListObjects");

  FUN_00436830(&local_4);

  puVar2 = local_4 + -5;

  LVar1 = InterlockedDecrement(local_4 + -4);

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

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

  }

  FUN_00401340("ListCommands");

  FUN_00436830(&local_4);

  puVar2 = local_4 + -5;

  LVar1 = InterlockedDecrement(local_4 + -4);

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

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

  }

  return;

}





// --- FUN_00433450 at 0x00433450 (size: 295) ---


undefined4 * FUN_00433450(undefined4 *param_1,undefined4 *param_2,byte *param_3)



{

  byte bVar1;

  byte *pbVar2;

  int iVar3;

  LONG LVar4;

  byte *pbVar5;

  undefined4 *puVar6;

  bool bVar7;

  

  do {

    pbVar2 = (byte *)*param_1;

    pbVar5 = param_3;

    do {

      bVar1 = *pbVar2;

      bVar7 = bVar1 < *pbVar5;

      if (bVar1 != *pbVar5) {

LAB_00433488:

        iVar3 = (1 - (uint)bVar7) - (uint)(bVar7 != 0);

        goto joined_r0x0043348f;

      }

      if (bVar1 == 0) break;

      bVar1 = pbVar2[1];

      bVar7 = bVar1 < pbVar5[1];

      if (bVar1 != pbVar5[1]) goto LAB_00433488;

      pbVar2 = pbVar2 + 2;

      pbVar5 = pbVar5 + 2;

    } while (bVar1 != 0);

    iVar3 = 0;

joined_r0x0043348f:

    if (iVar3 < 0) {

      pbVar2 = (byte *)param_1[1];

      param_1 = param_1 + 1;

      pbVar5 = param_3;

      do {

        bVar1 = *pbVar2;

        bVar7 = bVar1 < *pbVar5;

        if (bVar1 != *pbVar5) {

LAB_004334c4:

          iVar3 = (1 - (uint)bVar7) - (uint)(bVar7 != 0);

          goto joined_r0x0043348f;

        }

        if (bVar1 == 0) break;

        bVar1 = pbVar2[1];

        bVar7 = bVar1 < pbVar5[1];

        if (bVar1 != pbVar5[1]) goto LAB_004334c4;

        pbVar2 = pbVar2 + 2;

        pbVar5 = pbVar5 + 2;

      } while (bVar1 != 0);

      iVar3 = 0;

      goto joined_r0x0043348f;

    }

    pbVar2 = (byte *)param_2[-1];

    pbVar5 = param_3;

    do {

      bVar1 = *pbVar5;

      bVar7 = bVar1 < *pbVar2;

      puVar6 = param_2;

      if (bVar1 != *pbVar2) {

LAB_004334f9:

        iVar3 = (1 - (uint)bVar7) - (uint)(bVar7 != 0);

        goto joined_r0x00433500;

      }

      if (bVar1 == 0) break;

      bVar1 = pbVar5[1];

      bVar7 = bVar1 < pbVar2[1];

      if (bVar1 != pbVar2[1]) goto LAB_004334f9;

      pbVar5 = pbVar5 + 2;

      pbVar2 = pbVar2 + 2;

    } while (bVar1 != 0);

    iVar3 = 0;

joined_r0x00433500:

    param_2 = puVar6 + -1;

    if (iVar3 < 0) {

      pbVar2 = (byte *)puVar6[-2];

      pbVar5 = param_3;

      do {

        bVar1 = *pbVar5;

        bVar7 = bVar1 < *pbVar2;

        puVar6 = param_2;

        if (bVar1 != *pbVar2) {

LAB_00433534:

          iVar3 = (1 - (uint)bVar7) - (uint)(bVar7 != 0);

          goto joined_r0x00433500;

        }

        if (bVar1 == 0) break;

        bVar1 = pbVar5[1];

        bVar7 = bVar1 < pbVar2[1];

        if (bVar1 != pbVar2[1]) goto LAB_00433534;

        pbVar5 = pbVar5 + 2;

        pbVar2 = pbVar2 + 2;

      } while (bVar1 != 0);

      iVar3 = 0;

      goto joined_r0x00433500;

    }

    if (param_2 <= param_1) {

      LVar4 = InterlockedDecrement((LONG *)(param_3 + -0x10));

      if ((LVar4 == 0) && (param_3 + -0x14 != (byte *)0x0)) {

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

      }

      return param_1;

    }

    FUN_00432c80(param_1,param_2);

    param_1 = param_1 + 1;

  } while( true );

}





// --- FUN_00433580 at 0x00433580 (size: 138) ---


void FUN_00433580(int *param_1,int param_2,int *param_3,int param_4,undefined4 param_5)



{

  LONG LVar1;

  int iVar2;

  

  iVar2 = *param_3;

  if (iVar2 != *param_1) {

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

    if ((LVar1 == 0) && ((undefined4 *)(iVar2 + -0x14) != (undefined4 *)0x0)) {

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

    }

    iVar2 = *param_1;

    *param_3 = iVar2;

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

  }

  iVar2 = param_4;

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

  FUN_004331b0(param_1,0,param_2 - (int)param_1 >> 2,iVar2,param_5);

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

  if ((LVar1 == 0) && ((undefined4 *)(param_4 + -0x14) != (undefined4 *)0x0)) {

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

  }

  return;

}





// --- FUN_00433610 at 0x00433610 (size: 78) ---


void FUN_00433610(int param_1,int param_2,undefined4 param_3)



{

  int iVar1;

  int iVar2;

  int iVar3;

  undefined4 uVar4;

  

  iVar1 = param_2 - param_1 >> 2;

  if (1 < iVar1) {

    iVar2 = (iVar1 + -2) / 2;

    while( true ) {

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

      uVar4 = param_3;

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

      FUN_004331b0(param_1,iVar2,iVar1,iVar3,uVar4);

      if (iVar2 == 0) break;

      iVar2 = iVar2 + -1;

    }

  }

  return;

}





// --- FUN_00433660 at 0x00433660 (size: 173) ---


undefined4 FUN_00433660(int *param_1,char *param_2)



{

  undefined4 *puVar1;

  LONG LVar2;

  char *pcVar3;

  undefined1 local_c [8];

  int local_4;

  

  puVar1 = (undefined4 *)param_2;

  *(undefined4 *)param_2 = 0;

  param_2 = (char *)*param_1;

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

  FUN_004080c0();

  _strlwr(param_2);

  FUN_00433100(local_c,&param_2);

  pcVar3 = param_2 + -0x14;

  if (local_4 != 0) {

    *puVar1 = *(undefined4 *)(local_4 + 8);

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

    if ((LVar2 == 0) && (pcVar3 != (char *)0x0)) {

      (*(code *)**(undefined4 **)pcVar3)(1);

    }

    return 1;

  }

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

  if ((LVar2 == 0) && (pcVar3 != (char *)0x0)) {

    (*(code *)**(undefined4 **)pcVar3)(1);

  }

  return 0;

}





// --- FUN_00433710 at 0x00433710 (size: 173) ---


undefined4 FUN_00433710(int *param_1,char *param_2)



{

  undefined4 *puVar1;

  LONG LVar2;

  char *pcVar3;

  undefined1 local_c [8];

  int local_4;

  

  puVar1 = (undefined4 *)param_2;

  *(undefined4 *)param_2 = 0;

  param_2 = (char *)*param_1;

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

  FUN_004080c0();

  _strlwr(param_2);

  FUN_00433100(local_c,&param_2);

  pcVar3 = param_2 + -0x14;

  if (local_4 != 0) {

    *puVar1 = *(undefined4 *)(local_4 + 8);

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

    if ((LVar2 == 0) && (pcVar3 != (char *)0x0)) {

      (*(code *)**(undefined4 **)pcVar3)(1);

    }

    return 1;

  }

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

  if ((LVar2 == 0) && (pcVar3 != (char *)0x0)) {

    (*(code *)**(undefined4 **)pcVar3)(1);

  }

  return 0;

}





// --- FUN_004337c0 at 0x004337C0 (size: 143) ---


undefined4 * __thiscall FUN_004337c0(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_007994f4;

  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_00433850 at 0x00433850 (size: 143) ---


undefined4 * __thiscall FUN_00433850(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_007994f8;

  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_004338e0 at 0x004338E0 (size: 200) ---


void FUN_004338e0(undefined4 *param_1,int param_2,byte *param_3,undefined4 param_4)



{

  byte bVar1;

  undefined4 *puVar2;

  byte *pbVar3;

  byte *pbVar4;

  int iVar5;

  LONG LVar6;

  byte *pbVar7;

  bool bVar8;

  undefined4 uVar9;

  

  pbVar3 = param_3;

  puVar2 = param_1;

  pbVar7 = (byte *)*param_1;

  pbVar4 = param_3;

  do {

    bVar1 = *pbVar4;

    bVar8 = bVar1 < *pbVar7;

    if (bVar1 != *pbVar7) {

LAB_00433914:

      iVar5 = (1 - (uint)bVar8) - (uint)(bVar8 != 0);

      goto LAB_00433919;

    }

    if (bVar1 == 0) break;

    bVar1 = pbVar4[1];

    bVar8 = bVar1 < pbVar7[1];

    if (bVar1 != pbVar7[1]) goto LAB_00433914;

    pbVar4 = pbVar4 + 2;

    pbVar7 = pbVar7 + 2;

  } while (bVar1 != 0);

  iVar5 = 0;

LAB_00433919:

  if (iVar5 < 0) {

    FUN_00432f30(param_1,param_2,param_2 + 4,&param_1,0);

    pbVar7 = (byte *)*puVar2;

    if (pbVar7 != pbVar3) {

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

      if ((LVar6 == 0) && (pbVar7 + -0x14 != (byte *)0x0)) {

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

      }

      *puVar2 = pbVar3;

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

    }

  }

  else {

    pbVar7 = param_3;

    uVar9 = param_4;

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

    FUN_00432d20(param_2,pbVar7,uVar9);

  }

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

  if ((LVar6 == 0) && (pbVar3 + -0x14 != (byte *)0x0)) {

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

  }

  return;

}





// --- FUN_004339b0 at 0x004339B0 (size: 88) ---


void FUN_004339b0(int param_1,int param_2,undefined4 param_3)



{

  int *piVar1;

  int iVar2;

  undefined4 uVar3;

  undefined4 uVar4;

  

  if (4 < (int)(param_2 - param_1 & 0xfffffffcU)) {

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

    do {

      iVar2 = *piVar1;

      uVar4 = 0;

      uVar3 = param_3;

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

      FUN_00433580(param_1,piVar1,piVar1,iVar2,uVar3,uVar4);

      piVar1 = piVar1 + -1;

    } while (4 < (int)((4 - param_1) + (int)piVar1 & 0xfffffffcU));

  }

  return;

}





// --- FUN_00433a10 at 0x00433A10 (size: 169) ---


void __fastcall FUN_00433a10(int param_1)



{

  int iVar1;

  int *piVar2;

  int *piVar3;

  LONG LVar4;

  int *piVar5;

  int *piVar6;

  undefined4 *puVar7;

  

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

  do {

    if (iVar1 == 0) {

      return;

    }

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

        piVar6 = (int *)*piVar5;

        goto LAB_00433a54;

      }

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

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

    }

    piVar5 = (int *)0x0;

    piVar6 = (int *)0x0;

LAB_00433a54:

    piVar3 = (int *)*piVar5;

    if (piVar3 == piVar6) {

LAB_00433a6d:

      *piVar5 = piVar3[1];

    }

    else {

      do {

        piVar2 = piVar3;

        piVar3 = (int *)piVar2[1];

      } while (piVar3 != piVar6);

      if (piVar2 == (int *)0x0) goto LAB_00433a6d;

      piVar2[1] = piVar3[1];

    }

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

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

      puVar7 = (undefined4 *)(*piVar6 + -0x14);

      LVar4 = InterlockedDecrement((LONG *)(*piVar6 + -0x10));

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

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

      }

      operator_delete(piVar6);

    }

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

  } while( true );

}





// --- FUN_00433ac0 at 0x00433AC0 (size: 69) ---


void FUN_00433ac0(int *param_1,int *param_2,undefined4 param_3)



{

  int *piVar1;

  int iVar2;

  undefined4 uVar3;

  

  piVar1 = param_1;

  if (param_1 != param_2) {

    while (piVar1 = piVar1 + 1, piVar1 != param_2) {

      iVar2 = *piVar1;

      uVar3 = param_3;

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

      FUN_004338e0(param_1,piVar1,iVar2,uVar3);

    }

  }

  return;

}





// --- FUN_00433b10 at 0x00433B10 (size: 165) ---


void FUN_00433b10(undefined4 *param_1,undefined4 *param_2,undefined4 *param_3,undefined4 param_4,

                 undefined4 param_5)



{

  byte bVar1;

  byte *pbVar2;

  int iVar3;

  undefined4 *puVar4;

  byte *pbVar5;

  bool bVar6;

  byte *pbVar7;

  undefined4 uVar8;

  undefined4 uVar9;

  

  FUN_00433610(param_1,param_2,param_5,0,0);

  puVar4 = param_2;

  do {

    if (param_3 <= puVar4) {

      FUN_004339b0(param_1,param_2,param_5);

      return;

    }

    pbVar7 = (byte *)*puVar4;

    pbVar5 = (byte *)*param_1;

    pbVar2 = pbVar7;

    do {

      bVar1 = *pbVar2;

      bVar6 = bVar1 < *pbVar5;

      if (bVar1 != *pbVar5) {

LAB_00433b64:

        iVar3 = (1 - (uint)bVar6) - (uint)(bVar6 != 0);

        goto LAB_00433b69;

      }

      if (bVar1 == 0) break;

      bVar1 = pbVar2[1];

      bVar6 = bVar1 < pbVar5[1];

      if (bVar1 != pbVar5[1]) goto LAB_00433b64;

      pbVar2 = pbVar2 + 2;

      pbVar5 = pbVar5 + 2;

    } while (bVar1 != 0);

    iVar3 = 0;

LAB_00433b69:

    if (iVar3 < 0) {

      uVar9 = 0;

      uVar8 = param_5;

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

      FUN_00433580(param_1,param_2,puVar4,pbVar7,uVar8,uVar9);

    }

    puVar4 = puVar4 + 1;

  } while( true );

}





// --- FUN_00433bc0 at 0x00433BC0 (size: 82) ---


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



{

  *param_1 = &PTR_FUN_0079954c;

  FUN_00433a10();

  param_1[1] = &PTR_FUN_007994f4;

  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_00433c20 at 0x00433C20 (size: 82) ---


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



{

  *param_1 = &PTR_FUN_00799550;

  FUN_00433a10();

  param_1[1] = &PTR_FUN_007994f8;

  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_00433c80 at 0x00433C80 (size: 157) ---


void __thiscall

FUN_00433c80(undefined4 param_1,int param_2,int param_3,undefined4 param_4,int param_5,

            undefined4 param_6)



{

  int *piVar1;

  int iVar2;

  undefined4 extraout_ECX;

  

  if (0x40 < (int)(param_3 - param_2 & 0xfffffffcU)) {

    while (param_5 != 0) {

      param_5 = param_5 + -1;

      piVar1 = (int *)FUN_00432be0(param_2,param_2 + ((param_3 - param_2 >> 2) -

                                                      (param_3 - param_2 >> 0x1f) >> 1) * 4,

                                   param_3 + -4,param_6,param_1);

      iVar2 = *piVar1;

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

      iVar2 = FUN_00433450(param_2,param_3,iVar2);

      FUN_00433c80(iVar2,param_3,0,param_5,param_6);

      param_1 = extraout_ECX;

      param_3 = iVar2;

      if ((int)(iVar2 - param_2 & 0xfffffffcU) < 0x41) {

        return;

      }

    }

    FUN_00433b10(param_2,param_3,param_3,0,param_6);

  }

  return;

}





// --- FUN_00433d20 at 0x00433D20 (size: 83) ---


undefined4 * __fastcall FUN_00433d20(undefined4 *param_1)



{

  *param_1 = 0;

  param_1[1] = 0;

  param_1[2] = 0;

  param_1[0x2003] = &PTR_FUN_0079954c;

  FUN_004337c0(0x17);

  param_1[0x2020] = &PTR_FUN_00799550;

  FUN_00433850(0x17);

  param_1[0x203d] = 0;

  param_1[0x203e] = 0;

  param_1[0x203f] = 0;

  return param_1;

}





// --- FUN_00433d80 at 0x00433D80 (size: 1009) ---


void __fastcall FUN_00433d80(int param_1)



{

  void *pvVar1;

  int *piVar2;

  int iVar3;

  LONG LVar4;

  int *piVar5;

  int *piVar6;

  int *piVar7;

  int *piVar8;

  int *piVar9;

  undefined4 *puVar10;

  int iVar11;

  undefined1 local_c [12];

  

  piVar2 = (int *)FUN_0052dcf0(local_c);

  iVar11 = *piVar2;

  piVar7 = (int *)piVar2[2];

  piVar2 = (int *)piVar2[1];

joined_r0x00433da9:

  while (piVar9 = piVar7, piVar9 != (int *)0x0) {

    do {

      iVar3 = (**(code **)(*(int *)piVar9[2] + 0x3c))();

      if (iVar3 != 0) {

        pvVar1 = (void *)piVar9[2];

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

          puVar10 = (undefined4 *)(*(int *)((int)pvVar1 + 8) + -0x14);

          LVar4 = InterlockedDecrement((LONG *)(*(int *)((int)pvVar1 + 8) + -0x10));

          if ((LVar4 == 0) && (puVar10 != (undefined4 *)0x0)) {

            (**(code **)*puVar10)(1);

          }

          puVar10 = (undefined4 *)(*(int *)((int)pvVar1 + 4) + -0x14);

          LVar4 = InterlockedDecrement((LONG *)(*(int *)((int)pvVar1 + 4) + -0x10));

          if ((LVar4 == 0) && (puVar10 != (undefined4 *)0x0)) {

            (**(code **)*puVar10)(1);

          }

          operator_delete(pvVar1);

        }

        piVar9[2] = 0;

        piVar6 = (int *)piVar9[1];

        piVar8 = piVar2;

        piVar7 = piVar6;

        if (piVar6 != (int *)0x0) goto LAB_00433e45;

        goto LAB_00433e36;

      }

      piVar9 = (int *)piVar9[1];

    } while (piVar9 != (int *)0x0);

    do {

      piVar2 = piVar2 + 1;

      if (piVar2 == (int *)(*(int *)(iVar11 + 0x60) + *(int *)(iVar11 + 0x68) * 4))

      goto LAB_00433ed7;

      piVar7 = (int *)*piVar2;

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

  }

LAB_00433ed7:

  piVar7 = (int *)FUN_0052dcf0(local_c);

  iVar3 = piVar7[2];

  iVar11 = *piVar7;

  piVar7 = (int *)piVar7[1];

  while (iVar3 != 0) {

    do {

      pvVar1 = *(void **)(iVar3 + 8);

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

        puVar10 = (undefined4 *)(*(int *)((int)pvVar1 + 8) + -0x14);

        LVar4 = InterlockedDecrement((LONG *)(*(int *)((int)pvVar1 + 8) + -0x10));

        if ((LVar4 == 0) && (puVar10 != (undefined4 *)0x0)) {

          (**(code **)*puVar10)(1);

        }

        puVar10 = (undefined4 *)(*(int *)((int)pvVar1 + 4) + -0x14);

        LVar4 = InterlockedDecrement((LONG *)(*(int *)((int)pvVar1 + 4) + -0x10));

        if ((LVar4 == 0) && (puVar10 != (undefined4 *)0x0)) {

          (**(code **)*puVar10)(1);

        }

        operator_delete(pvVar1);

      }

      *(undefined4 *)(iVar3 + 8) = 0;

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

    } while (iVar3 != 0);

    do {

      piVar7 = piVar7 + 1;

      if (piVar7 == (int *)(*(int *)(iVar11 + 0x60) + *(int *)(iVar11 + 0x68) * 4))

      goto LAB_00433f88;

      iVar3 = *piVar7;

    } while (iVar3 == 0);

  }

LAB_00433f88:

  FUN_00433a10();

  piVar7 = *(int **)(param_1 + 33000);

  do {

    if (piVar7 == (int *)(*(int *)(param_1 + 0x80e4) + *(int *)(param_1 + 0x80ec) * 4)) {

      piVar7 = (int *)0x0;

      iVar11 = 0;

joined_r0x00433fdc:

      while (iVar11 != 0) {

        do {

          pvVar1 = *(void **)(iVar11 + 8);

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

            puVar10 = (undefined4 *)(*(int *)((int)pvVar1 + 8) + -0x14);

            LVar4 = InterlockedDecrement((LONG *)(*(int *)((int)pvVar1 + 8) + -0x10));

            if ((LVar4 == 0) && (puVar10 != (undefined4 *)0x0)) {

              (**(code **)*puVar10)(1);

            }

            puVar10 = (undefined4 *)(*(int *)((int)pvVar1 + 4) + -0x14);

            LVar4 = InterlockedDecrement((LONG *)(*(int *)((int)pvVar1 + 4) + -0x10));

            if ((LVar4 == 0) && (puVar10 != (undefined4 *)0x0)) {

              (**(code **)*puVar10)(1);

            }

            operator_delete(pvVar1);

          }

          *(undefined4 *)(iVar11 + 8) = 0;

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

        } while (iVar11 != 0);

        do {

          piVar7 = piVar7 + 1;

          if (piVar7 == (int *)(*(int *)(param_1 + 0x80e4) + *(int *)(param_1 + 0x80ec) * 4))

          goto LAB_0043406b;

          iVar11 = *piVar7;

        } while (iVar11 == 0);

      }

LAB_0043406b:

      FUN_00433a10();

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

      if ((*(uint *)(param_1 + 0x80f8) & 0x80000000) == 0x80000000) {

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

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

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

      }

      else if (*(int *)(param_1 + 0x80f4) != 0) {

        iVar11 = (*(uint *)(param_1 + 0x80f8) & 0x7fffffff) - 1;

        while (-1 < iVar11) {

          iVar11 = iVar11 + -1;

          *(undefined4 *)(*(int *)(param_1 + 0x80f4) + 4 + iVar11 * 4) = 0;

        }

      }

      if ((*(uint *)(param_1 + 0x80f8) & 0x80000000) == 0x80000000) {

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

      }

      *(undefined ***)(param_1 + 0x8080) = &PTR_FUN_00799550;

      FUN_00433a10();

      *(undefined ***)(param_1 + 0x8084) = &PTR_FUN_007994f8;

      if (*(void **)(param_1 + 0x80e4) != (void *)(param_1 + 0x8088)) {

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

      }

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

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

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

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

      *(undefined ***)(param_1 + 0x800c) = &PTR_FUN_0079954c;

      FUN_00433a10();

      *(undefined ***)(param_1 + 0x8010) = &PTR_FUN_007994f4;

      if (*(void **)(param_1 + 0x8070) != (void *)(param_1 + 0x8014)) {

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

      }

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

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

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

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

      return;

    }

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

      piVar7 = *(int **)(param_1 + 33000);

      iVar11 = *piVar7;

      goto joined_r0x00433fdc;

    }

    piVar7 = *(int **)(param_1 + 33000) + 1;

    *(int **)(param_1 + 33000) = piVar7;

  } while( true );

  while (piVar7 = (int *)*piVar8, piVar7 == (int *)0x0) {

LAB_00433e36:

    piVar8 = piVar8 + 1;

    piVar7 = piVar6;

    if (piVar8 == (int *)(*(int *)(iVar11 + 0x60) + *(int *)(iVar11 + 0x68) * 4)) break;

  }

LAB_00433e45:

  piVar6 = (int *)*piVar2;

  if (piVar6 != piVar9) {

    do {

      piVar5 = piVar6;

      piVar6 = (int *)piVar5[1];

    } while (piVar6 != piVar9);

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

      piVar5[1] = piVar6[1];

      goto LAB_00433e6a;

    }

  }

  *piVar2 = piVar6[1];

LAB_00433e6a:

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

  piVar2 = piVar8;

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

    puVar10 = (undefined4 *)(*piVar9 + -0x14);

    LVar4 = InterlockedDecrement((LONG *)(*piVar9 + -0x10));

    if ((LVar4 == 0) && (puVar10 != (undefined4 *)0x0)) {

      (**(code **)*puVar10)(1);

    }

    operator_delete(piVar9);

  }

  goto joined_r0x00433da9;

}





// --- FUN_00434180 at 0x00434180 (size: 334) ---


undefined1 FUN_00434180(int *param_1)



{

  undefined *puVar1;

  char cVar2;

  int iVar3;

  int *piVar4;

  LONG LVar5;

  undefined1 uVar6;

  undefined4 *puVar7;

  undefined *puStack_4;

  

  piVar4 = param_1;

  if (param_1[2] == 0) {

    return 0;

  }

  uVar6 = 1;

  if (DAT_008380c8 == 0) {

    iVar3 = FUN_005df0f5(0x8100);

    if (iVar3 == 0) {

      DAT_008380c8 = 0;

    }

    else {

      DAT_008380c8 = FUN_00433d20();

    }

  }

  cVar2 = FUN_00433710(*piVar4,&param_1);

  if (cVar2 == '\0') {

    param_1 = (int *)PTR_DAT_00818344;

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

    FUN_00402710(&param_1,"Unrecognized object: %s\n\n",*(undefined4 *)*piVar4);

    FUN_004355a0(&param_1);

    puVar1 = (undefined *)param_1;

    uVar6 = 0;

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

  }

  else {

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

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

      return 1;

    }

    puStack_4 = PTR_DAT_00818344;

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

    (**(code **)(*piVar4 + 0x4c))(&puStack_4);

    param_1 = (int *)PTR_DAT_00818344;

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

    FUN_00402710(&param_1,"%s == %s\n\n",piVar4[1],puStack_4);

    FUN_004355a0(&param_1);

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

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

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

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

    }

    puVar1 = puStack_4;

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

  }

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

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

  }

  return uVar6;

}





// --- FUN_004346f0 at 0x004346F0 (size: 729) ---


undefined4 FUN_004346f0(void)



{

  uint uVar1;

  char cVar2;

  LONG LVar3;

  int iVar4;

  int *piVar5;

  int iVar6;

  int iVar7;

  int iVar8;

  char *pcVar9;

  int iVar10;

  char *pcVar11;

  int iVar12;

  undefined4 *puVar13;

  int *piVar14;

  char *local_28;

  int local_24;

  uint local_20;

  uint local_1c;

  int iStack_18;

  int *piStack_14;

  undefined1 auStack_c [12];

  

  FUN_00401340("Listing available commands:\n\n");

  FUN_004355a0(&local_28);

  pcVar11 = local_28 + -0x14;

  LVar3 = InterlockedDecrement((LONG *)(local_28 + -0x10));

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

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

  }

  iVar10 = 0;

  local_24 = 0;

  local_20 = 0;

  local_1c = 0;

  if (DAT_008380c8 == 0) {

    iVar4 = FUN_005df0f5(0x8100);

    if (iVar4 == 0) {

      DAT_008380c8 = 0;

    }

    else {

      DAT_008380c8 = FUN_00433d20();

    }

  }

  piVar5 = (int *)FUN_0052dcf0(auStack_c);

  iStack_18 = *piVar5;

  piVar14 = (int *)piVar5[1];

  iVar4 = piVar5[2];

  piStack_14 = piVar14;

  if (DAT_008380c8 == 0) {

    iVar6 = FUN_005df0f5(0x8100);

    if (iVar6 == 0) {

      DAT_008380c8 = 0;

    }

    else {

      DAT_008380c8 = FUN_00433d20();

    }

  }

  while (iVar4 != 0) {

    do {

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

      if (local_1c < (local_20 & 0x7fffffff)) {

LAB_00434833:

        local_1c = local_1c + 1;

      }

      else {

        pcVar11 = (char *)((local_20 & 0x7fffffff) + 1);

        if (pcVar11 < (char *)0x9) {

          pcVar11 = (char *)0x8;

        }

        else if (pcVar11 < (char *)0x4001) {

          iVar10 = 0x1f;

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

            for (; (uint)pcVar11 >> iVar10 == 0; iVar10 = iVar10 + -1) {

            }

          }

          pcVar9 = (char *)(1 << ((byte)iVar10 & 0x1f));

          piVar14 = piStack_14;

          local_28 = pcVar11;

          if (pcVar9 < pcVar11) {

            pcVar11 = (char *)((int)pcVar9 * 2);

          }

        }

        else if (((uint)pcVar11 & 0x3fff) != 0) {

          pcVar11 = pcVar11 + (0x4000 - ((uint)pcVar11 & 0x3fff));

        }

        cVar2 = FUN_004082c0(pcVar11);

        iVar10 = local_24;

        if (cVar2 != '\0') goto LAB_00434833;

      }

      FUN_00402710(iVar10 + -4 + local_1c * 4,"%s - %s\n",*(undefined4 *)(iVar6 + 4),

                   *(undefined4 *)(iVar6 + 8));

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

    } while (iVar4 != 0);

    do {

      piVar14 = piVar14 + 1;

      piStack_14 = piVar14;

      if (piVar14 == (int *)(*(int *)(iStack_18 + 0x60) + *(int *)(iStack_18 + 0x68) * 4))

      goto LAB_0043488b;

      iVar4 = *piVar14;

    } while (iVar4 == 0);

  }

LAB_0043488b:

  iVar4 = iVar10 + local_1c * 4;

  iVar6 = iVar10;

  uVar1 = local_1c;

  if (iVar10 != iVar4) {

    iVar8 = 0;

    iVar12 = iVar4 - iVar10 >> 2;

    for (iVar7 = iVar12; iVar7 != 1; iVar7 = iVar7 >> 1) {

      iVar8 = iVar8 + 1;

    }

    FUN_00433c80(iVar10,iVar4,0,iVar8 * 2,local_28);

    pcVar11 = local_28;

    if (iVar12 < 0x11) {

      FUN_00433ac0(iVar10,iVar4,local_28);

      uVar1 = local_1c;

    }

    else {

      FUN_00433ac0(iVar10,iVar10 + 0x40,local_28);

      FUN_00433160(iVar10 + 0x40,iVar4,0,pcVar11);

      uVar1 = local_1c;

    }

  }

  for (; uVar1 != 0; uVar1 = uVar1 - 1) {

    FUN_004355a0(iVar6);

    iVar6 = iVar6 + 4;

  }

  pcVar11 = "\n";

  do {

    pcVar9 = pcVar11;

    pcVar11 = pcVar9 + 1;

  } while (*pcVar9 != '\0');

  FUN_00401280(pcVar9 + -0x795508);

  pcVar9 = "\n";

  pcVar11 = local_28;

  do {

    cVar2 = *pcVar9;

    pcVar9 = pcVar9 + 1;

    *pcVar11 = cVar2;

    pcVar11 = pcVar11 + 1;

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

  FUN_004355a0(&local_28);

  pcVar11 = local_28 + -0x14;

  LVar3 = InterlockedDecrement((LONG *)(local_28 + -0x10));

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

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

  }

  if (((local_20 & 0x80000000) == 0x80000000) && (iVar10 != 0)) {

    iVar6 = *(int *)(iVar10 + -4);

    iVar4 = iVar10 + iVar6 * 4;

    if (-1 < iVar6 + -1) {

      do {

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

        iVar4 = iVar4 + -4;

        puVar13 = (undefined4 *)(*piVar14 + -0x14);

        LVar3 = InterlockedDecrement((LONG *)(*piVar14 + -0x10));

        if ((LVar3 == 0) && (puVar13 != (undefined4 *)0x0)) {

          (**(code **)*puVar13)(1);

        }

        iVar6 = iVar6 + -1;

      } while (iVar6 != 0);

    }

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

  }

  return 1;

}





// --- FUN_004349d0 at 0x004349D0 (size: 729) ---


undefined4 FUN_004349d0(void)



{

  uint uVar1;

  char cVar2;

  LONG LVar3;

  int iVar4;

  int *piVar5;

  int iVar6;

  int iVar7;

  int iVar8;

  char *pcVar9;

  int iVar10;

  char *pcVar11;

  int iVar12;

  undefined4 *puVar13;

  int *piVar14;

  char *local_28;

  int local_24;

  uint local_20;

  uint local_1c;

  int iStack_18;

  int *piStack_14;

  undefined1 auStack_c [12];

  

  FUN_00401340("Listing available objects:\n\n");

  FUN_004355a0(&local_28);

  pcVar11 = local_28 + -0x14;

  LVar3 = InterlockedDecrement((LONG *)(local_28 + -0x10));

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

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

  }

  iVar10 = 0;

  local_24 = 0;

  local_20 = 0;

  local_1c = 0;

  if (DAT_008380c8 == 0) {

    iVar4 = FUN_005df0f5(0x8100);

    if (iVar4 == 0) {

      DAT_008380c8 = 0;

    }

    else {

      DAT_008380c8 = FUN_00433d20();

    }

  }

  piVar5 = (int *)FUN_0052dcf0(auStack_c);

  iStack_18 = *piVar5;

  piVar14 = (int *)piVar5[1];

  iVar4 = piVar5[2];

  piStack_14 = piVar14;

  if (DAT_008380c8 == 0) {

    iVar6 = FUN_005df0f5(0x8100);

    if (iVar6 == 0) {

      DAT_008380c8 = 0;

    }

    else {

      DAT_008380c8 = FUN_00433d20();

    }

  }

  while (iVar4 != 0) {

    do {

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

      if (local_1c < (local_20 & 0x7fffffff)) {

LAB_00434b13:

        local_1c = local_1c + 1;

      }

      else {

        pcVar11 = (char *)((local_20 & 0x7fffffff) + 1);

        if (pcVar11 < (char *)0x9) {

          pcVar11 = (char *)0x8;

        }

        else if (pcVar11 < (char *)0x4001) {

          iVar10 = 0x1f;

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

            for (; (uint)pcVar11 >> iVar10 == 0; iVar10 = iVar10 + -1) {

            }

          }

          pcVar9 = (char *)(1 << ((byte)iVar10 & 0x1f));

          piVar14 = piStack_14;

          local_28 = pcVar11;

          if (pcVar9 < pcVar11) {

            pcVar11 = (char *)((int)pcVar9 * 2);

          }

        }

        else if (((uint)pcVar11 & 0x3fff) != 0) {

          pcVar11 = pcVar11 + (0x4000 - ((uint)pcVar11 & 0x3fff));

        }

        cVar2 = FUN_004082c0(pcVar11);

        iVar10 = local_24;

        if (cVar2 != '\0') goto LAB_00434b13;

      }

      FUN_00402710(iVar10 + -4 + local_1c * 4,"%s - %s\n",*(undefined4 *)(iVar6 + 4),

                   *(undefined4 *)(iVar6 + 8));

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

    } while (iVar4 != 0);

    do {

      piVar14 = piVar14 + 1;

      piStack_14 = piVar14;

      if (piVar14 == (int *)(*(int *)(iStack_18 + 0x60) + *(int *)(iStack_18 + 0x68) * 4))

      goto LAB_00434b6b;

      iVar4 = *piVar14;

    } while (iVar4 == 0);

  }

LAB_00434b6b:

  iVar4 = iVar10 + local_1c * 4;

  iVar6 = iVar10;

  uVar1 = local_1c;

  if (iVar10 != iVar4) {

    iVar8 = 0;

    iVar12 = iVar4 - iVar10 >> 2;

    for (iVar7 = iVar12; iVar7 != 1; iVar7 = iVar7 >> 1) {

      iVar8 = iVar8 + 1;

    }

    FUN_00433c80(iVar10,iVar4,0,iVar8 * 2,local_28);

    pcVar11 = local_28;

    if (iVar12 < 0x11) {

      FUN_00433ac0(iVar10,iVar4,local_28);

      uVar1 = local_1c;

    }

    else {

      FUN_00433ac0(iVar10,iVar10 + 0x40,local_28);

      FUN_00433160(iVar10 + 0x40,iVar4,0,pcVar11);

      uVar1 = local_1c;

    }

  }

  for (; uVar1 != 0; uVar1 = uVar1 - 1) {

    FUN_004355a0(iVar6);

    iVar6 = iVar6 + 4;

  }

  pcVar11 = "\n";

  do {

    pcVar9 = pcVar11;

    pcVar11 = pcVar9 + 1;

  } while (*pcVar9 != '\0');

  FUN_00401280(pcVar9 + -0x795508);

  pcVar9 = "\n";

  pcVar11 = local_28;

  do {

    cVar2 = *pcVar9;

    pcVar9 = pcVar9 + 1;

    *pcVar11 = cVar2;

    pcVar11 = pcVar11 + 1;

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

  FUN_004355a0(&local_28);

  pcVar11 = local_28 + -0x14;

  LVar3 = InterlockedDecrement((LONG *)(local_28 + -0x10));

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

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

  }

  if (((local_20 & 0x80000000) == 0x80000000) && (iVar10 != 0)) {

    iVar6 = *(int *)(iVar10 + -4);

    iVar4 = iVar10 + iVar6 * 4;

    if (-1 < iVar6 + -1) {

      do {

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

        iVar4 = iVar4 + -4;

        puVar13 = (undefined4 *)(*piVar14 + -0x14);

        LVar3 = InterlockedDecrement((LONG *)(*piVar14 + -0x10));

        if ((LVar3 == 0) && (puVar13 != (undefined4 *)0x0)) {

          (**(code **)*puVar13)(1);

        }

        iVar6 = iVar6 + -1;

      } while (iVar6 != 0);

    }

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

  }

  return 1;

}





// --- FUN_00434e60 at 0x00434E60 (size: 931) ---


undefined4 * __fastcall FUN_00434e60(undefined4 *param_1)



{

  LONG LVar1;

  undefined4 *puVar2;

  int local_c;

  int local_8;

  int iStack_4;

  

  *param_1 = &PTR_LAB_00799534;

  FUN_00401340("Displays a list of each command with a brief description");

  FUN_00401340("ListCommands");

  FUN_00436580(FUN_004346f0,&local_c,&local_8);

  puVar2 = (undefined4 *)(local_c + -0x14);

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

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

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

  }

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

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

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

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

  }

  FUN_00401340("Displays a list of each object with a brief description");

  FUN_00401340("ListObjects");

  FUN_00436580(FUN_004349d0,&local_8,&local_c);

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

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

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

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

  }

  puVar2 = (undefined4 *)(local_c + -0x14);

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

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

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

  }

  FUN_00401340(

              "Help [command name]  (if you omit the command name, a list of available commands will be provided.)"

              );

  FUN_00401340("Displays description and usage information for commands and variables");

  FUN_00401340(&DAT_00799518);

  FUN_004366d0(&LAB_00434cb0,&local_8,&local_c,&iStack_4);

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

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

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

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

  }

  puVar2 = (undefined4 *)(local_c + -0x14);

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

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

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

  }

  puVar2 = (undefined4 *)(iStack_4 + -0x14);

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

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

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

  }

  FUN_00401340("Dump <object name>");

  FUN_00401340("Displays information about an object");

  FUN_00401340(&DAT_00799520);

  FUN_004366d0(FUN_00434180,&iStack_4,&local_8,&local_c);

  puVar2 = (undefined4 *)(iStack_4 + -0x14);

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

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

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

  }

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

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

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

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

  }

  puVar2 = (undefined4 *)(local_c + -0x14);

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

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

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

  }

  FUN_00401340("Set <object name> [component name] <data>");

  FUN_00401340("Sets the contents of an object");

  FUN_00401340(&DAT_00799528);

  FUN_004366d0(&LAB_004342d0,&iStack_4,&local_8,&local_c);

  puVar2 = (undefined4 *)(iStack_4 + -0x14);

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

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

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

  }

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

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

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

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

  }

  puVar2 = (undefined4 *)(local_c + -0x14);

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

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

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

  }

  FUN_00401340("Toggle <object name>");

  FUN_00401340("Toggles the contents of a boolean variable");

  FUN_00401340("Toggle");

  FUN_004366d0(&LAB_00434560,&iStack_4,&local_8,&local_c);

  puVar2 = (undefined4 *)(iStack_4 + -0x14);

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

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

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

  }

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

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

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

  }

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

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

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

  }

  FUN_00401340("Console initialized.\n\n");

  FUN_004355a0(&iStack_4);

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

  if ((LVar1 == 0) && ((undefined4 *)(iStack_4 + -0x14) != (undefined4 *)0x0)) {

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

  }

  return param_1;

}





// --- FUN_00435210 at 0x00435210 (size: 8) ---


void FUN_00435210(void)



{

  FUN_00405f70();

  return;

}





// --- FUN_00435220 at 0x00435220 (size: 34) ---


int __thiscall FUN_00435220(int param_1,byte param_2)



{

  FUN_00435250();

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

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

  }

  return param_1 + -4;

}





// --- FUN_00435250 at 0x00435250 (size: 37) ---


void __fastcall FUN_00435250(undefined4 *param_1)



{

  *param_1 = &PTR_FUN_007998e8;

  param_1[-1] = &PTR_LAB_007998ec;

  *(undefined ***)(-(uint)(param_1 != (undefined4 *)0x4) & (uint)param_1) = &PTR_FUN_007952f4;

  FUN_004332e0();

  return;

}





// --- FUN_004352e0 at 0x004352E0 (size: 59) ---


void FUN_004352e0(void)



{

  int iVar1;

  

  if (DAT_008380c8 == 0) {

    iVar1 = FUN_005df0f5(0x8100);

    if (iVar1 == 0) {

      DAT_008380c8 = 0;

    }

    else {

      DAT_008380c8 = FUN_00433d20();

    }

  }

  FUN_00693b70(&stack0x00000004);

  return;

}





// --- FUN_00435320 at 0x00435320 (size: 99) ---


void __fastcall FUN_00435320(int param_1)



{

  LONG LVar1;

  undefined4 *puVar2;

  

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

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

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

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

  }

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

  LVar1 = InterlockedDecrement((LONG *)(*(int *)(param_1 + 8) + -0x10));

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

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

  }

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

  LVar1 = InterlockedDecrement((LONG *)(*(int *)(param_1 + 4) + -0x10));

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

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

  }

  return;

}





// --- FUN_00435390 at 0x00435390 (size: 110) ---


void __thiscall FUN_00435390(int *param_1,int param_2)



{

  int *piVar1;

  LONG *lpAddend;

  int *piVar2;

  

  param_1[1] = param_2;

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

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

    *param_1 = 0;

    return;

  }

  *piVar1 = param_2;

  piVar2 = piVar1 + 1;

  if (-1 < param_2 + -1) {

    do {

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

      *piVar2 = (int)PTR_DAT_00818344;

      InterlockedIncrement(lpAddend);

      param_2 = param_2 + -1;

      piVar2 = piVar2 + 1;

    } while (param_2 != 0);

  }

  *param_1 = (int)(piVar1 + 1);

  return;

}





// --- FUN_00435400 at 0x00435400 (size: 67) ---


undefined4 * __fastcall FUN_00435400(undefined4 *param_1)



{

  LONG *pLVar1;

  

  *param_1 = &PTR_FUN_00799930;

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

  param_1[1] = PTR_DAT_00818344;

  InterlockedIncrement(pLVar1);

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

  param_1[2] = PTR_DAT_00818344;

  InterlockedIncrement(pLVar1);

  *param_1 = &PTR_FUN_00799978;

  param_1[3] = 0;

  return param_1;

}





// --- FUN_00435450 at 0x00435450 (size: 84) ---


undefined4 * __fastcall FUN_00435450(undefined4 *param_1)



{

  LONG *pLVar1;

  

  *param_1 = &PTR_FUN_00799930;

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

  param_1[1] = PTR_DAT_00818344;

  InterlockedIncrement(pLVar1);

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

  param_1[2] = PTR_DAT_00818344;

  InterlockedIncrement(pLVar1);

  *param_1 = &PTR_FUN_007999c0;

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

  param_1[3] = PTR_DAT_00818344;

  InterlockedIncrement(pLVar1);

  param_1[4] = 0;

  return param_1;

}





// --- FUN_004354b0 at 0x004354B0 (size: 77) ---


undefined4 * __fastcall FUN_004354b0(undefined4 *param_1)



{

  LONG *pLVar1;

  

  *param_1 = &PTR_FUN_00799930;

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

  param_1[1] = PTR_DAT_00818344;

  InterlockedIncrement(pLVar1);

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

  param_1[2] = PTR_DAT_00818344;

  InterlockedIncrement(pLVar1);

  *param_1 = &PTR_FUN_00799a08;

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

  param_1[3] = PTR_DAT_00818344;

  InterlockedIncrement(pLVar1);

  return param_1;

}





// --- FUN_00435500 at 0x00435500 (size: 71) ---


void __thiscall FUN_00435500(int param_1,int *param_2)



{

  int iVar1;

  LONG LVar2;

  

  iVar1 = *param_2;

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

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

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

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

    }

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

    *param_2 = iVar1;

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

                    /* WARNING: Treating indirect jump as call */

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

    return;

  }

  return;

}





// --- FUN_00435550 at 0x00435550 (size: 68) ---


undefined4 __thiscall FUN_00435550(int param_1,int *param_2)



{

  int iVar1;

  LONG LVar2;

  

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

  if (iVar1 != *param_2) {

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

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

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

    }

    iVar1 = *param_2;

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

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

  }

  return 1;

}





// --- FUN_004355a0 at 0x004355A0 (size: 287) ---


void FUN_004355a0(int *param_1)



{

  uint *puVar1;

  int iVar2;

  uint uVar3;

  uint uVar4;

  int iVar5;

  int *piVar6;

  int iVar7;

  int *piVar8;

  uint uVar9;

  

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

  if (iVar7 != 0) {

    uVar9 = 0;

    piVar8 = DAT_008380c8;

    if (iVar7 != 1) {

      do {

        iVar2 = *param_1;

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

        uVar4 = uVar3 - 1;

        if (uVar9 < uVar3) {

          uVar4 = uVar9;

        }

        piVar6 = piVar8;

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

          iVar5 = FUN_005df0f5(0x8100);

          if (iVar5 == 0) {

            piVar6 = (int *)0x0;

            DAT_008380c8 = piVar6;

          }

          else {

            piVar6 = (int *)FUN_00433d20();

            DAT_008380c8 = piVar6;

          }

        }

        uVar3 = piVar6[2];

        puVar1 = (uint *)(piVar6 + 2);

        piVar8 = piVar6;

        if (uVar3 == 0x8000) {

          *(undefined1 *)((int)piVar6 + *piVar6 + 0xc) = 0;

          if (*piVar6 == 0x7fff) {

            *piVar6 = 0;

          }

          else {

            *piVar6 = *piVar6 + 1;

          }

          *puVar1 = *puVar1 - 1;

          uVar3 = *puVar1;

          piVar8 = DAT_008380c8;

        }

        if (uVar3 < 0x8000) {

          *(undefined1 *)((int)piVar6 + piVar6[1] + 0xc) = *(undefined1 *)(uVar4 + iVar2);

          if (piVar6[1] == 0x7fff) {

            piVar6[1] = 0;

          }

          else {

            piVar6[1] = piVar6[1] + 1;

          }

          *puVar1 = *puVar1 + 1;

          piVar8 = DAT_008380c8;

        }

        uVar9 = uVar9 + 1;

      } while (uVar9 < iVar7 - 1U);

    }

    uVar9 = 0;

    while( true ) {

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

        iVar7 = FUN_005df0f5(0x8100);

        if (iVar7 == 0) {

          piVar8 = (int *)0x0;

          DAT_008380c8 = piVar8;

        }

        else {

          piVar8 = (int *)FUN_00433d20();

          DAT_008380c8 = piVar8;

        }

      }

      if ((uint)piVar8[0x203f] <= uVar9) break;

      (**(code **)**(undefined4 **)(piVar8[0x203d] + uVar9 * 4))(param_1);

      uVar9 = uVar9 + 1;

      piVar8 = DAT_008380c8;

    }

  }

  return;

}





// --- FUN_004356c0 at 0x004356C0 (size: 91) ---


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



{

  LONG LVar1;

  undefined4 *puVar2;

  

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

  LVar1 = InterlockedDecrement((LONG *)(*(int *)((int)param_1 + 8) + -0x10));

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

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

  }

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

  LVar1 = InterlockedDecrement((LONG *)(*(int *)((int)param_1 + 4) + -0x10));

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

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

  }

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

    operator_delete(param_1);

  }

  return param_1;

}





// --- FUN_00435720 at 0x00435720 (size: 324) ---


void __thiscall FUN_00435720(int *param_1,char param_2,char param_3,char *param_4)



{

  char cVar1;

  undefined *puVar2;

  char *pcVar3;

  LONG LVar4;

  LONG *lpAddend;

  int iVar5;

  char *pcVar6;

  

  pcVar6 = (char *)*param_1;

  iVar5 = *(int *)(pcVar6 + -4) + -1;

  if (param_2 != '\0') {

    cVar1 = *pcVar6;

    while ((cVar1 != '\0' && (pcVar3 = strchr(param_4,(int)cVar1), pcVar3 != (char *)0x0))) {

      cVar1 = pcVar6[1];

      pcVar6 = pcVar6 + 1;

      iVar5 = iVar5 + -1;

    }

  }

  if (param_3 != '\0') {

    while ((iVar5 != 0 && (pcVar3 = strchr(param_4,(int)pcVar6[iVar5 + -1]), pcVar3 != (char *)0x0))

          ) {

      iVar5 = iVar5 + -1;

    }

  }

  pcVar3 = (char *)*param_1;

  if ((pcVar6 == pcVar3) && (iVar5 == *(int *)(pcVar3 + -4) + -1)) {

    LVar4 = InterlockedDecrement((LONG *)(param_4 + -0x10));

    if ((LVar4 == 0) && (param_4 + -0x14 != (char *)0x0)) {

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

      return;

    }

  }

  else {

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

    puVar2 = (undefined *)*param_1;

    if (puVar2 != PTR_DAT_00818344) {

      LVar4 = InterlockedDecrement((LONG *)(puVar2 + -0x10));

      if ((LVar4 == 0) && ((undefined4 *)(puVar2 + -0x14) != (undefined4 *)0x0)) {

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

      }

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

      *param_1 = (int)PTR_DAT_00818344;

      InterlockedIncrement(lpAddend);

    }

    if (iVar5 != 0) {

      FUN_00404ef0(pcVar6,iVar5);

    }

    LVar4 = InterlockedDecrement((LONG *)(pcVar3 + -0x10));

    if ((LVar4 == 0) && (pcVar3 + -0x14 != (char *)0x0)) {

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

    }

    LVar4 = InterlockedDecrement((LONG *)(param_4 + -0x10));

    if ((LVar4 == 0) && (param_4 + -0x14 != (char *)0x0)) {

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

    }

  }

  return;

}





// --- FUN_00435870 at 0x00435870 (size: 86) ---


undefined4 * __fastcall FUN_00435870(undefined4 *param_1)



{

  LONG *pLVar1;

  

  *param_1 = &PTR_FUN_00799930;

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

  param_1[1] = PTR_DAT_00818344;

  InterlockedIncrement(pLVar1);

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

  param_1[2] = PTR_DAT_00818344;

  InterlockedIncrement(pLVar1);

  param_1[3] = 0;

  param_1[4] = 0;

  param_1[5] = 0;

  *param_1 = &PTR_FUN_00799a60;

  param_1[6] = 0;

  param_1[7] = 0;

  param_1[8] = 0;

  param_1[9] = 0;

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

  return param_1;

}





// --- FUN_004358e0 at 0x004358E0 (size: 62) ---


void __thiscall FUN_004358e0(int param_1,undefined4 param_2)



{

  float *pfVar1;

  uint uVar2;

  

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

    switch(*(undefined4 *)(param_1 + 0x10)) {

    case 3:

      break;

    case 4:

      break;

    case 5:

      break;

    case 6:

      break;

    case 7:

      break;

    case 8:

      break;

    default:

      goto LAB_0043595b;

    }

    uVar2 = FUN_00435b30();

    if ((uVar2 != 0xffffffff) && (uVar2 < *(uint *)(param_1 + 0x1c))) {

      FUN_00402070();

      return;

    }

  }

LAB_0043595b:

  switch(*(undefined4 *)(param_1 + 0x10)) {

  case 1:

    FUN_00402710();

    return;

  case 2:

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

      FUN_00405000();

      return;

    }

    FUN_00405000();

    return;

  case 3:

  case 4:

    break;

  case 5:

    break;

  case 6:

    break;

  case 7:

    break;

  case 8:

    break;

  case 9:

    FUN_00402710(param_2,&DAT_00799ad8,(double)**(float **)(param_1 + 0xc));

    return;

  case 10:

    FUN_00402710(param_2,&DAT_00799ad8,**(undefined8 **)(param_1 + 0xc));

    return;

  case 0xb:

    pfVar1 = *(float **)(param_1 + 0xc);

    FUN_00402710(param_2,"%.2f %.2f %.2f",(double)*pfVar1,(double)pfVar1[1],(double)pfVar1[2]);

    return;

  case 0xc:

    pfVar1 = *(float **)(param_1 + 0xc);

    FUN_00402710(param_2,"%.2f %.2f %.2f %.2f",(double)*pfVar1,(double)pfVar1[1],(double)pfVar1[2],

                 (double)pfVar1[3]);

    return;

  case 0xd:

    FUN_00402070();

    return;

  case 0xe:

    FUN_005b2c30();

    FUN_00402070();

    FUN_004011b0();

  default:

    return;

  }

  FUN_00402710();

  return;

}





// --- FUN_00435b30 at 0x00435B30 (size: 58) ---


uint __thiscall FUN_00435b30(int param_1,uint param_2)



{

  uint uVar1;

  uint uVar2;

  uint *puVar3;

  

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

  if (uVar1 == *(uint *)(param_1 + 0x1c)) {

    uVar2 = 0;

    if (uVar1 != 0) {

      puVar3 = *(uint **)(param_1 + 0x20);

      do {

        if (param_2 == *puVar3) {

          return uVar2;

        }

        uVar2 = uVar2 + 1;

        puVar3 = puVar3 + 1;

      } while (uVar2 < uVar1);

      return 0xffffffff;

    }

  }

  else if (param_2 < *(uint *)(param_1 + 0x1c)) {

    return param_2;

  }

  return 0xffffffff;

}





// --- FUN_00435ed0 at 0x00435ED0 (size: 105) ---


undefined4 FUN_00435ed0(undefined4 *param_1,undefined4 *param_2)



{

  int iVar1;

  undefined4 local_10;

  undefined4 local_c;

  undefined4 local_8;

  undefined4 local_4;

  

  iVar1 = sscanf((char *)*param_1,"%f %f %f %f",&local_10,&local_c,&local_8,&local_4);

  if (iVar1 == 3) {

    local_4 = 0x3f800000;

  }

  else if (iVar1 != 4) {

    return 0;

  }

  *param_2 = local_10;

  param_2[1] = local_c;

  param_2[2] = local_8;

  param_2[3] = local_4;

  return 1;

}





// --- FUN_00435f40 at 0x00435F40 (size: 48) ---


undefined4 FUN_00435f40(undefined4 *param_1,undefined4 *param_2)



{

  char *_Str;

  int *piVar1;

  double dVar2;

  

  _Str = (char *)*param_1;

  piVar1 = _errno();

  *piVar1 = 0;

  dVar2 = strtod(_Str,(char **)0x0);

  param_2[1] = (float)dVar2;

  *param_2 = 1;

  return 1;

}





// --- FUN_00435f70 at 0x00435F70 (size: 294) ---


undefined4 FUN_00435f70(undefined4 param_1,undefined4 param_2)



{

  bool bVar1;

  char cVar2;

  LONG LVar3;

  int local_10;

  int local_c;

  int iStack_8;

  int local_4;

  

  FUN_00401340("False");

  cVar2 = FUN_00404d20(&local_4,0);

  if (cVar2 == '\0') {

    FUN_00401340(&DAT_00799b04);

    cVar2 = FUN_00404d20(&local_10,0);

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

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

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

    }

    if (cVar2 == '\0') {

      FUN_00401340(&DAT_00799b00);

      cVar2 = FUN_00404d20(&local_c,0);

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

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

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

      }

      if (cVar2 == '\0') {

        FUN_00401340(&DAT_00799afc);

        cVar2 = FUN_00404d20(&iStack_8,0);

        LVar3 = InterlockedDecrement((LONG *)(iStack_8 + -0x10));

        if ((LVar3 == 0) && ((undefined4 *)(iStack_8 + -0x14) != (undefined4 *)0x0)) {

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

        }

        bVar1 = false;

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

      }

    }

  }

  bVar1 = true;

LAB_00436064:

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

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

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

  }

  *(bool *)param_2 = !bVar1;

  return 1;

}





// --- FUN_004360a0 at 0x004360A0 (size: 113) ---


void __fastcall FUN_004360a0(int param_1)



{

  LONG LVar1;

  undefined4 *puVar2;

  

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

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

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

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

    FUN_00407920(3);

  }

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

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

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

  LVar1 = InterlockedDecrement((LONG *)(*(int *)(param_1 + 8) + -0x10));

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

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

  }

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

  LVar1 = InterlockedDecrement((LONG *)(*(int *)(param_1 + 4) + -0x10));

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

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

  }

  return;

}





// --- FUN_00436120 at 0x00436120 (size: 105) ---


void FUN_00436120(undefined4 param_1)



{

  int *piVar1;

  char cVar2;

  int iVar3;

  uint uVar4;

  undefined4 uVar5;

  

  if (DAT_008380c8 == 0) {

    iVar3 = FUN_005df0f5(0x8100);

    if (iVar3 == 0) {

      DAT_008380c8 = 0;

    }

    else {

      DAT_008380c8 = FUN_00433d20();

    }

  }

  iVar3 = DAT_008380c8;

  piVar1 = (int *)(DAT_008380c8 + 0x80f4);

  uVar4 = *(uint *)(DAT_008380c8 + 0x80f8) & 0x7fffffff;

  if (uVar4 <= *(uint *)(DAT_008380c8 + 0x80fc)) {

    uVar5 = FUN_00453850(uVar4 + 1);

    cVar2 = FUN_004180a0(uVar5);

    if (cVar2 == '\0') {

      return;

    }

  }

  *(undefined4 *)(*piVar1 + *(int *)(iVar3 + 0x80fc) * 4) = param_1;

  piVar1 = (int *)(iVar3 + 0x80fc);

  *piVar1 = *piVar1 + 1;

  return;

}





// --- FUN_00436190 at 0x00436190 (size: 897) ---


/* WARNING: Type propagation algorithm not settling */



void FUN_00436190(int *param_1)



{

  char cVar1;

  int iVar2;

  LONG LVar3;

  undefined4 extraout_ECX;

  int iVar4;

  undefined4 *puVar5;

  int *piVar6;

  undefined4 uVar7;

  undefined *local_2c;

  int *piStack_28;

  int local_24;

  int iStack_20;

  int local_1c;

  uint local_18;

  undefined4 local_14;

  undefined **local_10;

  int *local_c;

  undefined4 local_8;

  int local_4;

  

  piVar6 = param_1;

  local_24 = *param_1;

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

  uVar7 = extraout_ECX;

  FUN_00401340(&DAT_00795098);

  FUN_00435720(1,1,uVar7);

  iVar4 = 0;

  local_10 = &PTR_FUN_00795074;

  local_c = (int *)0x0;

  local_8 = 0;

  local_4 = 0;

  cVar1 = thunk_FUN_0040c2d0(piVar6,0x20,&local_10);

  if (cVar1 == '\0') {

    local_10 = &PTR_FUN_00795074;

    FUN_00405210();

  }

  else {

    if (local_4 != 0) {

      local_2c = PTR_DAT_00818344;

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

      local_1c = 0;

      local_18 = 0;

      local_14 = 0;

      piVar6 = local_c;

LAB_00436260:

      do {

        if (piVar6 == (int *)0x0) goto LAB_004362af;

        if (iVar4 == 0) {

          if (local_2c != (undefined *)*piVar6) {

            puVar5 = (undefined4 *)(local_2c + -0x14);

            LVar3 = InterlockedDecrement((LONG *)(local_2c + -0x10));

            if ((LVar3 == 0) && (puVar5 != (undefined4 *)0x0)) {

              (**(code **)*puVar5)(1);

            }

            local_2c = (undefined *)*piVar6;

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

            piVar6 = (int *)piVar6[1];

            iVar4 = 1;

            goto LAB_00436260;

          }

        }

        else {

          FUN_0040c440(piVar6);

        }

        piVar6 = (int *)piVar6[1];

        iVar4 = iVar4 + 1;

      } while( true );

    }

    local_10 = &PTR_FUN_00795074;

    FUN_00405210();

  }

  iVar4 = local_24;

  iVar2 = InterlockedDecrement((LONG *)(local_24 + -0x10));

  goto joined_r0x004364fb;

LAB_004362af:

  if (DAT_008380c8 == 0) {

    iVar4 = FUN_005df0f5(0x8100);

    if (iVar4 == 0) {

      DAT_008380c8 = 0;

    }

    else {

      DAT_008380c8 = FUN_00433d20();

    }

  }

  cVar1 = FUN_00433660(&local_2c,&piStack_28);

  if (cVar1 == '\0') {

    param_1 = (int *)PTR_DAT_00818344;

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

    FUN_00402710(&param_1,"Unrecognized command: %s\n\n",local_2c);

    FUN_004355a0(&param_1);

    piVar6 = param_1;

    LVar3 = InterlockedDecrement(param_1 + -4);

joined_r0x0043648b:

    if ((LVar3 == 0) && ((int *)((int)piVar6 + 0xffffffecU) != (int *)0x0)) {

      (*(code *)**(undefined4 **)((int)piVar6 + 0xffffffecU))(1);

    }

  }

  else {

    iVar4 = (**(code **)(*piStack_28 + 0x14))();

    iVar2 = (**(code **)(*piStack_28 + 0x1c))();

    if (iVar4 == 0) {

      if (iVar2 != 0) {

        cVar1 = (**(code **)(iVar2 + 0x10))(&local_1c);

        goto joined_r0x00436329;

      }

LAB_0043632f:

      FUN_00401340("Command failed.\n\n");

      FUN_004355a0(&iStack_20);

      puVar5 = (undefined4 *)(iStack_20 + -0x14);

      LVar3 = InterlockedDecrement((LONG *)(iStack_20 + -0x10));

      if ((LVar3 == 0) && (puVar5 != (undefined4 *)0x0)) {

        (**(code **)*puVar5)(1);

      }

      param_1 = (int *)PTR_DAT_00818344;

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

      FUN_00402710(&param_1,"         Name: %s\n",piStack_28[1]);

      FUN_004355a0(&param_1);

      if (*(int *)(piStack_28[2] + -4) != 1) {

        FUN_00402710(&param_1,"  Description: %s\n",piStack_28[2]);

        FUN_004355a0(&param_1);

      }

      if ((iVar2 != 0) && (*(int *)(*(int *)(iVar2 + 0xc) + -4) != 1)) {

        FUN_00402710(&param_1,"        Usage: %s\n",*(int *)(iVar2 + 0xc));

        FUN_004355a0(&param_1);

      }

      FUN_00401340(&DAT_00795508);

      FUN_004355a0(&iStack_20);

      LVar3 = InterlockedDecrement((LONG *)(iStack_20 + -0x10));

      if ((LVar3 == 0) && ((undefined4 *)(iStack_20 + -0x14) != (undefined4 *)0x0)) {

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

      }

      piVar6 = param_1;

      LVar3 = InterlockedDecrement(param_1 + -4);

      goto joined_r0x0043648b;

    }

    cVar1 = (**(code **)(iVar4 + 0xc))();

joined_r0x00436329:

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

  }

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

    FUN_00407920(3);

  }

  puVar5 = (undefined4 *)(local_2c + -0x14);

  LVar3 = InterlockedDecrement((LONG *)(local_2c + -0x10));

  if ((LVar3 == 0) && (puVar5 != (undefined4 *)0x0)) {

    (**(code **)*puVar5)(1);

  }

  local_10 = &PTR_FUN_00795074;

  FUN_00405210();

  iVar4 = local_24;

  iVar2 = InterlockedDecrement((LONG *)(local_24 + -0x10));

joined_r0x004364fb:

  if ((iVar2 == 0) && ((undefined4 *)(iVar4 + -0x14) != (undefined4 *)0x0)) {

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

  }

  return;

}





// --- FUN_00436520 at 0x00436520 (size: 83) ---


undefined4 FUN_00436520(undefined4 param_1,int *param_2)



{

  int *piVar1;

  LONG LVar2;

  undefined4 *puVar3;

  

  piVar1 = (int *)FUN_005ded90(param_1);

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

    *param_2 = piVar1[2];

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

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

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

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

    }

    operator_delete(piVar1);

    return 1;

  }

  return 0;

}





// --- FUN_00436580 at 0x00436580 (size: 326) ---


void FUN_00436580(int param_1,int *param_2,undefined4 param_3)



{

  int *piVar1;

  char cVar2;

  char *pcVar3;

  int iVar4;

  LONG LVar5;

  char **ppcVar6;

  undefined4 *puVar7;

  char *pcStack_c;

  char *local_8;

  undefined1 auStack_4 [4];

  

  FUN_00401340(&DAT_00795098);

  piVar1 = param_2;

  pcVar3 = strstr((char *)*param_2,local_8);

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

    iVar4 = -1;

  }

  else {

    iVar4 = (int)pcVar3 - *piVar1;

  }

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

  if ((LVar5 == 0) && (local_8 + -0x14 != (char *)0x0)) {

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

  }

  if ((iVar4 == -1) && (param_1 != 0)) {

    if (DAT_008380c8 == 0) {

      iVar4 = FUN_005df0f5(0x8100);

      if (iVar4 == 0) {

        DAT_008380c8 = 0;

      }

      else {

        DAT_008380c8 = FUN_00433d20();

      }

    }

    cVar2 = FUN_00433660(piVar1,auStack_4);

    if (cVar2 == '\0') {

      iVar4 = FUN_005df0f5(0x10);

      if (iVar4 == 0) {

        iVar4 = 0;

      }

      else {

        iVar4 = FUN_00435400();

      }

      FUN_00402070(piVar1);

      FUN_00402070(param_3);

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

      pcStack_c = (char *)*piVar1;

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

      FUN_004080c0();

      _strlwr(pcStack_c);

      puVar7 = &param_2;

      ppcVar6 = &pcStack_c;

      param_2 = (int *)iVar4;

      FUN_00401750(ppcVar6,puVar7);

      cVar2 = FUN_0068c4c0(ppcVar6,puVar7);

      if (cVar2 == '\0') {

        FUN_004356c0(1);

      }

      FUN_004011b0();

    }

  }

  return;

}





// --- FUN_004366d0 at 0x004366D0 (size: 346) ---


void FUN_004366d0(int param_1,int *param_2,undefined4 param_3,undefined4 param_4)



{

  int *piVar1;

  char cVar2;

  char *pcVar3;

  int iVar4;

  LONG LVar5;

  void *pvVar6;

  char **ppcVar7;

  undefined4 *puVar8;

  char *pcStack_c;

  char *local_8;

  undefined1 auStack_4 [4];

  

  FUN_00401340(&DAT_00795098);

  piVar1 = param_2;

  pcVar3 = strstr((char *)*param_2,local_8);

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

    iVar4 = -1;

  }

  else {

    iVar4 = (int)pcVar3 - *piVar1;

  }

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

  if ((LVar5 == 0) && (local_8 + -0x14 != (char *)0x0)) {

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

  }

  if ((iVar4 == -1) && (param_1 != 0)) {

    if (DAT_008380c8 == 0) {

      iVar4 = FUN_005df0f5(0x8100);

      if (iVar4 == 0) {

        DAT_008380c8 = 0;

      }

      else {

        DAT_008380c8 = FUN_00433d20();

      }

    }

    cVar2 = FUN_00433660(piVar1,auStack_4);

    if (cVar2 == '\0') {

      iVar4 = FUN_005df0f5(0x14);

      if (iVar4 == 0) {

        pvVar6 = (void *)0x0;

      }

      else {

        pvVar6 = (void *)FUN_00435450();

      }

      FUN_00402070(piVar1);

      FUN_00402070(param_3);

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

      FUN_00402070(param_4);

      pcStack_c = (char *)*piVar1;

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

      FUN_004080c0();

      _strlwr(pcStack_c);

      puVar8 = &param_2;

      ppcVar7 = &pcStack_c;

      param_2 = pvVar6;

      FUN_00401750(ppcVar7,puVar8);

      cVar2 = FUN_0068c4c0(ppcVar7,puVar8);

      if (cVar2 == '\0') {

        FUN_00435320();

        operator_delete(pvVar6);

      }

      FUN_004011b0();

    }

  }

  return;

}





// --- FUN_00436830 at 0x00436830 (size: 355) ---


void FUN_00436830(int *param_1)



{

  void *pvVar1;

  char cVar2;

  int iVar3;

  LONG LVar4;

  undefined4 *puVar5;

  char *pcVar6;

  char *local_c;

  void *local_8;

  undefined1 local_4 [4];

  

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

    iVar3 = FUN_005df0f5(0x8100);

    if (iVar3 == 0) {

      DAT_008380c8 = (void *)0x0;

    }

    else {

      DAT_008380c8 = (void *)FUN_00433d20();

    }

  }

  cVar2 = FUN_00433660(param_1,&local_8);

  if (cVar2 != '\0') {

    local_c = (char *)*param_1;

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

    FUN_004080c0();

    _strlwr(local_c);

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

      iVar3 = FUN_005df0f5(0x8100);

      if (iVar3 == 0) {

        DAT_008380c8 = (void *)0x0;

      }

      else {

        DAT_008380c8 = (void *)FUN_00433d20();

      }

    }

    FUN_00436520(&local_c,local_4);

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

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

      LVar4 = InterlockedDecrement((LONG *)(*(int *)((int)local_8 + 8) + -0x10));

      if ((LVar4 == 0) && (puVar5 != (undefined4 *)0x0)) {

        (**(code **)*puVar5)(1);

      }

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

      LVar4 = InterlockedDecrement((LONG *)(*(int *)((int)local_8 + 4) + -0x10));

      if ((LVar4 == 0) && (puVar5 != (undefined4 *)0x0)) {

        (**(code **)*puVar5)(1);

      }

      operator_delete(local_8);

    }

    pcVar6 = local_c + -0x14;

    local_8 = (void *)0x0;

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

    if ((LVar4 == 0) && (pcVar6 != (char *)0x0)) {

      (*(code *)**(undefined4 **)pcVar6)(1);

    }

  }

  if ((DAT_008380c8 != (void *)0x0) &&

     (cVar2 = FUN_00432fa0(), pvVar1 = DAT_008380c8, cVar2 != '\0')) {

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

      FUN_00433d80();

      operator_delete(pvVar1);

    }

    DAT_008380c8 = (void *)0x0;

  }

  return;

}





// --- FUN_004369a0 at 0x004369A0 (size: 830) ---


void FUN_004369a0(int param_1,int param_2,int *param_3,undefined4 param_4,int param_5,char *param_6,

                 int param_7,int param_8)



{

  bool bVar1;

  char cVar2;

  char *pcVar3;

  int iVar4;

  LONG LVar5;

  int *piVar6;

  int *piVar7;

  undefined4 *puVar8;

  code *pcVar9;

  int **ppiVar10;

  char *pcStack_14;

  int *piStack_10;

  undefined *puStack_c;

  int *local_8;

  undefined1 auStack_4 [4];

  

  if ((param_6 == (char *)0x0) || (param_7 != 0)) {

    FUN_00401340(&DAT_00795098);

    pcVar3 = strstr((char *)*param_3,param_6);

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

      iVar4 = -1;

    }

    else {

      iVar4 = (int)pcVar3 - *param_3;

    }

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

    if ((LVar5 == 0) && (param_6 + -0x14 != (char *)0x0)) {

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

    }

    if (((iVar4 == -1) && (param_1 != 0)) && (param_2 != 0)) {

      ppiVar10 = &local_8;

      piVar7 = param_3;

      FUN_00401750(param_3,ppiVar10);

      cVar2 = FUN_00433710(piVar7,ppiVar10);

      piVar7 = (int *)0x0;

      if ((cVar2 == '\0') ||

         (piVar7 = (int *)(**(code **)(*local_8 + 0x3c))(), piVar7 != (int *)0x0)) {

        iVar4 = FUN_005df0f5(0x2c);

        if (iVar4 == 0) {

          piVar6 = (int *)0x0;

        }

        else {

          piVar6 = (int *)FUN_00435870();

        }

        FUN_00402070(param_3);

        FUN_00402070(param_4);

        piVar6[3] = param_1;

        piVar6[4] = param_2;

        piVar6[5] = param_5;

        *(undefined1 *)(piVar6 + 10) = 0;

        if (param_6 != (char *)0x0) {

          FUN_00435390(param_6);

          pcVar3 = (char *)0x0;

          if (param_6 != (char *)0x0) {

            do {

              FUN_00402070((int)pcVar3 * 4 + param_7);

              pcVar3 = pcVar3 + 1;

            } while (pcVar3 < param_6);

          }

          if (param_8 != 0) {

            piVar6[9] = (int)param_6;

            iVar4 = thunk_FUN_005df0f5((int)param_6 * 4);

            piVar6[8] = iVar4;

            pcVar3 = (char *)0x0;

            if (param_6 != (char *)0x0) {

              do {

                *(undefined4 *)(piVar6[8] + (int)pcVar3 * 4) =

                     *(undefined4 *)(param_8 + (int)pcVar3 * 4);

                pcVar3 = pcVar3 + 1;

              } while (pcVar3 < param_6);

            }

          }

        }

        puStack_c = PTR_DAT_00818344;

        bVar1 = false;

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

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

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

          (**(code **)(*piVar7 + 0x4c))(&puStack_c);

          piStack_10 = (int *)*param_3;

          bVar1 = true;

          InterlockedIncrement(piStack_10 + -4);

          FUN_004080c0();

          _strlwr((char *)piStack_10);

          if (DAT_008380c8 == 0) {

            iVar4 = FUN_005df0f5(0x8100);

            if (iVar4 == 0) {

              DAT_008380c8 = 0;

            }

            else {

              DAT_008380c8 = FUN_00433d20();

            }

          }

          FUN_00436520(&piStack_10,auStack_4);

          FUN_00435320();

          operator_delete(piVar7);

          piVar7 = piStack_10 + -5;

          LVar5 = InterlockedDecrement(piStack_10 + -4);

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

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

          }

        }

        pcStack_14 = (char *)*param_3;

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

        FUN_004080c0();

        _strlwr(pcStack_14);

        piStack_10 = piVar6;

        if (DAT_008380c8 == 0) {

          iVar4 = FUN_005df0f5(0x8100);

          if (iVar4 == 0) {

            DAT_008380c8 = 0;

          }

          else {

            DAT_008380c8 = FUN_00433d20();

          }

        }

        cVar2 = FUN_0068c4c0(&pcStack_14,&piStack_10);

        if (cVar2 == '\0') {

          FUN_004360a0();

          operator_delete(piVar6);

          pcVar9 = InterlockedDecrement_exref;

          pcVar3 = pcStack_14 + -0x14;

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

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

            (*(code *)**(undefined4 **)pcVar3)(1);

          }

        }

        else {

          if (bVar1) {

            (**(code **)(*piVar6 + 0x50))(&puStack_c);

          }

          pcVar9 = InterlockedDecrement_exref;

          pcVar3 = pcStack_14 + -0x14;

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

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

            (*(code *)**(undefined4 **)pcVar3)(1);

          }

        }

        puVar8 = (undefined4 *)(puStack_c + -0x14);

        iVar4 = (*pcVar9)(puStack_c + -0x10);

        if ((iVar4 == 0) && (puVar8 != (undefined4 *)0x0)) {

          (**(code **)*puVar8)(1);

        }

      }

    }

  }

  return;

}





// --- FUN_00436cf0 at 0x00436CF0 (size: 452) ---


void FUN_00436cf0(int *param_1)



{

  char cVar1;

  int iVar2;

  int *piVar3;

  LONG LVar4;

  char *pcVar5;

  void *pvVar6;

  char **ppcVar7;

  void **ppvVar8;

  char *pcStack_c;

  int *local_8;

  void *pvStack_4;

  

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

    iVar2 = FUN_005df0f5(0x8100);

    if (iVar2 == 0) {

      DAT_008380c8 = (void *)0x0;

    }

    else {

      DAT_008380c8 = (void *)FUN_00433d20();

    }

  }

  cVar1 = FUN_00433710(param_1,&local_8);

  if (cVar1 != '\0') {

    piVar3 = (int *)(**(code **)(*local_8 + 0x44))();

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

      return;

    }

    pvVar6 = (void *)0x0;

    cVar1 = (**(code **)(*piVar3 + 0x48))();

    if (cVar1 != '\0') {

      iVar2 = FUN_005df0f5(0x10);

      if (iVar2 == 0) {

        pvVar6 = (void *)0x0;

      }

      else {

        pvVar6 = (void *)FUN_004354b0();

      }

      FUN_00402070(piVar3 + 1);

      FUN_00402070(piVar3 + 2);

      (**(code **)(*piVar3 + 0x4c))((int)pvVar6 + 0xc);

    }

    pcStack_c = (char *)*param_1;

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

    FUN_004080c0();

    _strlwr(pcStack_c);

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

      iVar2 = FUN_005df0f5(0x8100);

      if (iVar2 == 0) {

        DAT_008380c8 = (void *)0x0;

      }

      else {

        DAT_008380c8 = (void *)FUN_00433d20();

      }

    }

    FUN_00436520(&pcStack_c,&pvStack_4);

    FUN_004360a0();

    operator_delete(piVar3);

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

      ppvVar8 = &pvStack_4;

      ppcVar7 = &pcStack_c;

      pvStack_4 = pvVar6;

      FUN_00401750(ppcVar7,ppvVar8);

      cVar1 = FUN_0068c4c0(ppcVar7,ppvVar8);

      if (cVar1 == '\0') {

        FUN_00435320();

        operator_delete(pvVar6);

        FUN_004011b0();

        return;

      }

    }

    pcVar5 = pcStack_c + -0x14;

    LVar4 = InterlockedDecrement((LONG *)(pcStack_c + -0x10));

    if ((LVar4 == 0) && (pcVar5 != (char *)0x0)) {

      (*(code *)**(undefined4 **)pcVar5)(1);

    }

  }

  if ((DAT_008380c8 != (void *)0x0) &&

     (cVar1 = FUN_00432fa0(), pvVar6 = DAT_008380c8, cVar1 != '\0')) {

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

      FUN_00433d80();

      operator_delete(pvVar6);

    }

    DAT_008380c8 = (void *)0x0;

  }

  return;

}





// --- FUN_00436ec0 at 0x00436EC0 (size: 492) ---


void FUN_00436ec0(int *param_1,undefined4 param_2)



{

  undefined *puVar1;

  char *_String;

  char cVar2;

  int iVar3;

  int *piVar4;

  int *piVar5;

  LONG LVar6;

  LONG *lpAddend;

  int *local_8 [2];

  

  if (DAT_008380c8 == 0) {

    iVar3 = FUN_005df0f5();

    if (iVar3 == 0) {

      DAT_008380c8 = 0;

    }

    else {

      DAT_008380c8 = FUN_00433d20();

    }

  }

  cVar2 = FUN_00433710(param_1,local_8);

  if ((cVar2 != '\0') && (iVar3 = (**(code **)(*local_8[0] + 0x34))(), iVar3 != 0)) {

    piVar4 = (int *)(**(code **)(*local_8[0] + 0x34))();

    piVar5 = (int *)(**(code **)(*piVar4 + 0x44))();

    if ((piVar5 != (int *)0x0) && (cVar2 = (**(code **)(*piVar5 + 0x48))(), cVar2 == '\0')) {

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

    }

    (**(code **)(*piVar4 + 0x50))(param_2);

    return;

  }

  iVar3 = FUN_005df0f5(0x10);

  if (iVar3 == 0) {

    piVar4 = (int *)0x0;

  }

  else {

    piVar4 = (int *)FUN_004354b0();

  }

  iVar3 = piVar4[1];

  if (iVar3 != *param_1) {

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

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

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

    }

    iVar3 = *param_1;

    piVar4[1] = iVar3;

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

  }

  puVar1 = (undefined *)piVar4[2];

  if (puVar1 != PTR_DAT_00818344) {

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

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

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

    }

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

    piVar4[2] = (int)PTR_DAT_00818344;

    InterlockedIncrement(lpAddend);

  }

  (**(code **)(*piVar4 + 0x50))(param_2);

  _String = (char *)*param_1;

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

  FUN_004080c0();

  _strlwr(_String);

  local_8[0] = piVar4;

  if (DAT_008380c8 == 0) {

    iVar3 = FUN_005df0f5(0x8100);

    if (iVar3 == 0) {

      DAT_008380c8 = 0;

    }

    else {

      DAT_008380c8 = FUN_00433d20();

    }

  }

  cVar2 = FUN_0068c4c0(&stack0xfffffff0,local_8);

  if (cVar2 == '\0') {

    FUN_00435320();

    operator_delete(piVar4);

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

    if ((LVar6 == 0) && (_String + -0x14 != (char *)0x0)) {

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

      return;

    }

  }

  else {

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

    if ((LVar6 == 0) && (_String + -0x14 != (char *)0x0)) {

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

    }

  }

  return;

}





// --- thunk_FUN_00436cf0 at 0x004370B0 (size: 5) ---


void thunk_FUN_00436cf0(int *param_1)



{

  char cVar1;

  int iVar2;

  int *piVar3;

  LONG LVar4;

  char *pcVar5;

  void *pvVar6;

  char **ppcVar7;

  void **ppvVar8;

  char *pcStack_c;

  int *piStack_8;

  void *pvStack_4;

  

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

    iVar2 = FUN_005df0f5(0x8100);

    if (iVar2 == 0) {

      DAT_008380c8 = (void *)0x0;

    }

    else {

      DAT_008380c8 = (void *)FUN_00433d20();

    }

  }

  cVar1 = FUN_00433710(param_1,&piStack_8);

  if (cVar1 != '\0') {

    piVar3 = (int *)(**(code **)(*piStack_8 + 0x44))();

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

      return;

    }

    pvVar6 = (void *)0x0;

    cVar1 = (**(code **)(*piVar3 + 0x48))();

    if (cVar1 != '\0') {

      iVar2 = FUN_005df0f5(0x10);

      if (iVar2 == 0) {

        pvVar6 = (void *)0x0;

      }

      else {

        pvVar6 = (void *)FUN_004354b0();

      }

      FUN_00402070(piVar3 + 1);

      FUN_00402070(piVar3 + 2);

      (**(code **)(*piVar3 + 0x4c))((int)pvVar6 + 0xc);

    }

    pcStack_c = (char *)*param_1;

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

    FUN_004080c0();

    _strlwr(pcStack_c);

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

      iVar2 = FUN_005df0f5(0x8100);

      if (iVar2 == 0) {

        DAT_008380c8 = (void *)0x0;

      }

      else {

        DAT_008380c8 = (void *)FUN_00433d20();

      }

    }

    FUN_00436520(&pcStack_c,&pvStack_4);

    FUN_004360a0();

    operator_delete(piVar3);

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

      ppvVar8 = &pvStack_4;

      ppcVar7 = &pcStack_c;

      pvStack_4 = pvVar6;

      FUN_00401750(ppcVar7,ppvVar8);

      cVar1 = FUN_0068c4c0(ppcVar7,ppvVar8);

      if (cVar1 == '\0') {

        FUN_00435320();

        operator_delete(pvVar6);

        FUN_004011b0();

        return;

      }

    }

    pcVar5 = pcStack_c + -0x14;

    LVar4 = InterlockedDecrement((LONG *)(pcStack_c + -0x10));

    if ((LVar4 == 0) && (pcVar5 != (char *)0x0)) {

      (*(code *)**(undefined4 **)pcVar5)(1);

    }

  }

  if ((DAT_008380c8 != (void *)0x0) &&

     (cVar1 = FUN_00432fa0(), pvVar6 = DAT_008380c8, cVar1 != '\0')) {

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

      FUN_00433d80();

      operator_delete(pvVar6);

    }

    DAT_008380c8 = (void *)0x0;

  }

  return;

}





// --- FUN_004370c0 at 0x004370C0 (size: 114) ---


undefined4 FUN_004370c0(undefined4 param_1,int param_2)



{

  char cVar1;

  int iVar2;

  int *piVar3;

  int *local_4;

  

  if (DAT_008380c8 == 0) {

    iVar2 = FUN_005df0f5(0x8100);

    if (iVar2 == 0) {

      DAT_008380c8 = 0;

    }

    else {

      DAT_008380c8 = FUN_00433d20();

    }

  }

  cVar1 = FUN_00433710(param_1,&local_4);

  if ((((cVar1 != '\0') && (piVar3 = (int *)(**(code **)(*local_4 + 0x44))(), piVar3 != (int *)0x0))

      && (cVar1 = (**(code **)(*piVar3 + 0x48))(), cVar1 != '\0')) &&

     ((param_2 == 0 || (piVar3[4] == param_2)))) {

    return 1;

  }

  return 0;

}





// --- FUN_00437140 at 0x00437140 (size: 113) ---


undefined4 FUN_00437140(undefined4 param_1,int *param_2)



{

  int *piVar1;

  char cVar2;

  int iVar3;

  int *piVar4;

  

  piVar1 = param_2;

  *param_2 = 0;

  if (DAT_008380c8 == 0) {

    iVar3 = FUN_005df0f5(0x8100);

    if (iVar3 == 0) {

      DAT_008380c8 = 0;

    }

    else {

      DAT_008380c8 = FUN_00433d20();

    }

  }

  cVar2 = FUN_00433710(param_1,&param_2);

  if (cVar2 != '\0') {

    piVar4 = (int *)(**(code **)(*param_2 + 0x34))();

    if ((piVar4 != (int *)0x0) && (cVar2 = (**(code **)(*piVar4 + 0x48))(), cVar2 != '\0')) {

      *piVar1 = (int)piVar4;

      return 1;

    }

  }

  return 0;

}





// --- FUN_004371c0 at 0x004371C0 (size: 181) ---


bool FUN_004371c0(undefined4 param_1,undefined1 *param_2)



{

  char cVar1;

  int iVar2;

  int *piVar3;

  bool bVar4;

  int *piStack_8;

  int *local_4;

  

  if (DAT_008380c8 == 0) {

    iVar2 = FUN_005df0f5(0x8100);

    if (iVar2 == 0) {

      DAT_008380c8 = 0;

    }

    else {

      DAT_008380c8 = FUN_00433d20();

    }

  }

  cVar1 = FUN_00433710(param_1,&local_4);

  if (cVar1 != '\0') {

    piVar3 = (int *)(**(code **)(*local_4 + 0x44))();

    if (((piVar3 != (int *)0x0) && (cVar1 = (**(code **)(*piVar3 + 0x48))(), cVar1 != '\0')) &&

       (piVar3[4] == 2)) {

      piStack_8 = (int *)0x0;

      cVar1 = FUN_00437140(param_1,&piStack_8);

      bVar4 = false;

      if (cVar1 != '\0') {

        iVar2 = (**(code **)(*piStack_8 + 0x44))();

        bVar4 = iVar2 != 0;

        if (((bVar4) && (iVar2 != 0)) && (*(int *)(iVar2 + 0x10) == 2)) {

          *param_2 = **(undefined1 **)(iVar2 + 0xc);

        }

      }

      return bVar4;

    }

  }

  return false;

}





// --- FUN_00437280 at 0x00437280 (size: 181) ---


bool FUN_00437280(undefined4 param_1,undefined4 *param_2)



{

  char cVar1;

  int iVar2;

  int *piVar3;

  bool bVar4;

  int *piStack_8;

  int *local_4;

  

  if (DAT_008380c8 == 0) {

    iVar2 = FUN_005df0f5(0x8100);

    if (iVar2 == 0) {

      DAT_008380c8 = 0;

    }

    else {

      DAT_008380c8 = FUN_00433d20();

    }

  }

  cVar1 = FUN_00433710(param_1,&local_4);

  if (cVar1 != '\0') {

    piVar3 = (int *)(**(code **)(*local_4 + 0x44))();

    if (((piVar3 != (int *)0x0) && (cVar1 = (**(code **)(*piVar3 + 0x48))(), cVar1 != '\0')) &&

       (piVar3[4] == 3)) {

      piStack_8 = (int *)0x0;

      cVar1 = FUN_00437140(param_1,&piStack_8);

      bVar4 = false;

      if (cVar1 != '\0') {

        iVar2 = (**(code **)(*piStack_8 + 0x44))();

        bVar4 = iVar2 != 0;

        if (((bVar4) && (iVar2 != 0)) && (*(int *)(iVar2 + 0x10) == 3)) {

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

        }

      }

      return bVar4;

    }

  }

  return false;

}





// --- FUN_00437340 at 0x00437340 (size: 181) ---


bool FUN_00437340(undefined4 param_1,undefined4 *param_2)



{

  char cVar1;

  int iVar2;

  int *piVar3;

  bool bVar4;

  int *piStack_8;

  int *local_4;

  

  if (DAT_008380c8 == 0) {

    iVar2 = FUN_005df0f5(0x8100);

    if (iVar2 == 0) {

      DAT_008380c8 = 0;

    }

    else {

      DAT_008380c8 = FUN_00433d20();

    }

  }

  cVar1 = FUN_00433710(param_1,&local_4);

  if (cVar1 != '\0') {

    piVar3 = (int *)(**(code **)(*local_4 + 0x44))();

    if (((piVar3 != (int *)0x0) && (cVar1 = (**(code **)(*piVar3 + 0x48))(), cVar1 != '\0')) &&

       (piVar3[4] == 4)) {

      piStack_8 = (int *)0x0;

      cVar1 = FUN_00437140(param_1,&piStack_8);

      bVar4 = false;

      if (cVar1 != '\0') {

        iVar2 = (**(code **)(*piStack_8 + 0x44))();

        bVar4 = iVar2 != 0;

        if (((bVar4) && (iVar2 != 0)) && (*(int *)(iVar2 + 0x10) == 4)) {

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

        }

      }

      return bVar4;

    }

  }

  return false;

}





// --- FUN_00437400 at 0x00437400 (size: 181) ---


bool FUN_00437400(undefined4 param_1,undefined4 *param_2)



{

  char cVar1;

  int iVar2;

  int *piVar3;

  bool bVar4;

  int *piStack_8;

  int *local_4;

  

  if (DAT_008380c8 == 0) {

    iVar2 = FUN_005df0f5(0x8100);

    if (iVar2 == 0) {

      DAT_008380c8 = 0;

    }

    else {

      DAT_008380c8 = FUN_00433d20();

    }

  }

  cVar1 = FUN_00433710(param_1,&local_4);

  if (cVar1 != '\0') {

    piVar3 = (int *)(**(code **)(*local_4 + 0x44))();

    if (((piVar3 != (int *)0x0) && (cVar1 = (**(code **)(*piVar3 + 0x48))(), cVar1 != '\0')) &&

       (piVar3[4] == 9)) {

      piStack_8 = (int *)0x0;

      cVar1 = FUN_00437140(param_1,&piStack_8);

      bVar4 = false;

      if (cVar1 != '\0') {

        iVar2 = (**(code **)(*piStack_8 + 0x44))();

        bVar4 = iVar2 != 0;

        if (((bVar4) && (iVar2 != 0)) && (*(int *)(iVar2 + 0x10) == 9)) {

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

        }

      }

      return bVar4;

    }

  }

  return false;

}





// --- FUN_004374c0 at 0x004374C0 (size: 70) ---


void __fastcall FUN_004374c0(int *param_1)



{

  LONG LVar1;

  undefined4 *puVar2;

  

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

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

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

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

  }

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

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

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

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

  }

  return;

}





// --- FUN_00437510 at 0x00437510 (size: 204) ---


undefined4 FUN_00437510(int *param_1)



{

  char cVar1;

  LONG LVar2;

  undefined4 *puVar3;

  undefined *local_4;

  

  local_4 = PTR_DAT_00818344;

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

  cVar1 = FUN_0040dc00(param_1,&local_4);

  if ((cVar1 == '\0') && (local_4 != (undefined *)*param_1)) {

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

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

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

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

    }

    local_4 = (undefined *)*param_1;

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

  }

  thunk_FUN_0040da10(&local_4,0);

  if (DAT_00838188 != local_4) {

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

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

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

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

    }

    DAT_00838188 = local_4;

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

  }

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

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

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

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

  }

  return 1;

}





// --- FUN_004375e0 at 0x004375E0 (size: 92) ---


void __thiscall FUN_004375e0(int param_1,undefined4 *param_2)



{

  LONG LVar1;

  undefined4 *puVar2;

  

  if ((*(int *)(param_1 + 0x10) == 3) &&

     (**(undefined4 **)(param_1 + 0xc) = *param_2, *(int *)(param_1 + 0x14) != 0)) {

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

    InterlockedIncrement((LONG *)((int)param_2 + -0x10));

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

    puVar2 = (undefined4 *)((int)param_2 + -0x14);

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

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

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

    }

  }

  return;

}





// --- FUN_00437640 at 0x00437640 (size: 92) ---


void __thiscall FUN_00437640(int param_1,undefined4 *param_2)



{

  LONG LVar1;

  undefined4 *puVar2;

  

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

     (**(undefined4 **)(param_1 + 0xc) = *param_2, *(int *)(param_1 + 0x14) != 0)) {

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

    InterlockedIncrement((LONG *)((int)param_2 + -0x10));

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

    puVar2 = (undefined4 *)((int)param_2 + -0x14);

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

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

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

    }

  }

  return;

}





// --- FUN_004376a0 at 0x004376A0 (size: 92) ---


void __thiscall FUN_004376a0(int param_1,undefined4 *param_2)



{

  LONG LVar1;

  undefined4 *puVar2;

  

  if ((*(int *)(param_1 + 0x10) == 9) &&

     (**(undefined4 **)(param_1 + 0xc) = *param_2, *(int *)(param_1 + 0x14) != 0)) {

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

    InterlockedIncrement((LONG *)((int)param_2 + -0x10));

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

    puVar2 = (undefined4 *)((int)param_2 + -0x14);

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

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

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

    }

  }

  return;

}





// --- FUN_00437700 at 0x00437700 (size: 151) ---


void __thiscall FUN_00437700(int param_1,int *param_2)



{

  int *piVar1;

  int iVar2;

  int *piVar3;

  LONG LVar4;

  undefined4 *puVar5;

  

  piVar3 = param_2;

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

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

    iVar2 = *piVar1;

    if (iVar2 != *param_2) {

      LVar4 = InterlockedDecrement((LONG *)(iVar2 + -0x10));

      if ((LVar4 == 0) && ((undefined4 *)(iVar2 + -0x14) != (undefined4 *)0x0)) {

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

      }

      iVar2 = *piVar3;

      *piVar1 = iVar2;

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

    }

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

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

      InterlockedIncrement((LONG *)((int)param_2 + -0x10));

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

      puVar5 = (undefined4 *)((int)param_2 + -0x14);

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

      if ((LVar4 == 0) && (puVar5 != (undefined4 *)0x0)) {

        (**(code **)*puVar5)(1);

      }

    }

  }

  return;

}





// --- FUN_004377a0 at 0x004377A0 (size: 76) ---


void __thiscall FUN_004377a0(int param_1,int *param_2)



{

  int iVar1;

  int *piVar2;

  LONG LVar3;

  

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

    iVar1 = *param_2;

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

    if (iVar1 != *piVar2) {

      LVar3 = InterlockedDecrement((LONG *)(iVar1 + -0x10));

      if ((LVar3 == 0) && ((undefined4 *)(iVar1 + -0x14) != (undefined4 *)0x0)) {

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

      }

      iVar1 = *piVar2;

      *param_2 = iVar1;

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

                    /* WARNING: Treating indirect jump as call */

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

      return;

    }

  }

  return;

}





// --- FUN_004377f0 at 0x004377F0 (size: 157) ---


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



{

  int *piVar1;

  LONG LVar2;

  undefined4 *puVar3;

  int *piVar4;

  int local_4;

  

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

    FUN_004374c0();

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

      operator_delete(param_1);

    }

    return param_1;

  }

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

  piVar4 = (int *)((int)param_1 + local_4 * 8);

  if (-1 < local_4 + -1) {

    do {

      piVar1 = piVar4 + -1;

      piVar4 = piVar4 + -2;

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

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

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

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

      }

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

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

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

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

      }

      local_4 = local_4 + -1;

    } while (local_4 != 0);

  }

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

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

  }

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

}





// --- FUN_00437890 at 0x00437890 (size: 119) ---


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



{

  int iVar1;

  LONG LVar2;

  

  iVar1 = *param_1;

  if (iVar1 != *param_2) {

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

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

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

    }

    iVar1 = *param_2;

    *param_1 = iVar1;

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

  }

  iVar1 = param_1[1];

  if (iVar1 != param_2[1]) {

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

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

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

    }

    iVar1 = param_2[1];

    param_1[1] = iVar1;

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

  }

  return param_1;

}





// --- FUN_00437940 at 0x00437940 (size: 217) ---


void __fastcall FUN_00437940(int *param_1)



{

  uint uVar1;

  LONG LVar2;

  undefined4 *puVar3;

  undefined *local_8;

  undefined *local_4;

  

  param_1[2] = 0;

  if ((param_1[1] & 0x80000000U) != 0x80000000) {

    if (*param_1 != 0) {

      uVar1 = param_1[1] & 0x7fffffff;

      while (uVar1 = uVar1 - 1, -1 < (int)uVar1) {

        local_8 = PTR_DAT_00818344;

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

        local_4 = PTR_DAT_00818344;

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

        FUN_00437890(&local_8);

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

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

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

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

        }

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

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

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

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

        }

      }

    }

    return;

  }

  if (*param_1 != 0) {

    FUN_004377f0(3);

  }

  *param_1 = 0;

  param_1[1] = 0;

  return;

}





// --- FUN_00437a20 at 0x00437A20 (size: 179) ---


bool FUN_00437a20(undefined4 param_1)



{

  char cVar1;

  int iVar2;

  int *piVar3;

  bool bVar4;

  int *piStack_8;

  int *local_4;

  

  if (DAT_008380c8 == 0) {

    iVar2 = FUN_005df0f5(0x8100);

    if (iVar2 == 0) {

      DAT_008380c8 = 0;

    }

    else {

      DAT_008380c8 = FUN_00433d20();

    }

  }

  cVar1 = FUN_00433710(param_1,&local_4);

  if ((((cVar1 != '\0') && (piVar3 = (int *)(**(code **)(*local_4 + 0x44))(), piVar3 != (int *)0x0))

      && (cVar1 = (**(code **)(*piVar3 + 0x48))(), cVar1 != '\0')) && (piVar3[4] == 2)) {

    piStack_8 = (int *)0x0;

    cVar1 = FUN_00437140(param_1,&piStack_8);

    bVar4 = false;

    if (cVar1 != '\0') {

      iVar2 = (**(code **)(*piStack_8 + 0x44))();

      bVar4 = iVar2 != 0;

      if ((bVar4) && (iVar2 != 0)) {

        FUN_00432b80(&stack0x00000008);

      }

    }

    return bVar4;

  }

  return false;

}





// --- FUN_00437ae0 at 0x00437AE0 (size: 179) ---


bool FUN_00437ae0(undefined4 param_1)



{

  char cVar1;

  int iVar2;

  int *piVar3;

  bool bVar4;

  int *piStack_8;

  int *local_4;

  

  if (DAT_008380c8 == 0) {

    iVar2 = FUN_005df0f5(0x8100);

    if (iVar2 == 0) {

      DAT_008380c8 = 0;

    }

    else {

      DAT_008380c8 = FUN_00433d20();

    }

  }

  cVar1 = FUN_00433710(param_1,&local_4);

  if ((((cVar1 != '\0') && (piVar3 = (int *)(**(code **)(*local_4 + 0x44))(), piVar3 != (int *)0x0))

      && (cVar1 = (**(code **)(*piVar3 + 0x48))(), cVar1 != '\0')) && (piVar3[4] == 3)) {

    piStack_8 = (int *)0x0;

    cVar1 = FUN_00437140(param_1,&piStack_8);

    bVar4 = false;

    if (cVar1 != '\0') {

      iVar2 = (**(code **)(*piStack_8 + 0x44))();

      bVar4 = iVar2 != 0;

      if ((bVar4) && (iVar2 != 0)) {

        FUN_004375e0(&stack0x00000008);

      }

    }

    return bVar4;

  }

  return false;

}





// --- FUN_00437ba0 at 0x00437BA0 (size: 179) ---


bool FUN_00437ba0(undefined4 param_1)



{

  char cVar1;

  int iVar2;

  int *piVar3;

  bool bVar4;

  int *piStack_8;

  int *local_4;

  

  if (DAT_008380c8 == 0) {

    iVar2 = FUN_005df0f5(0x8100);

    if (iVar2 == 0) {

      DAT_008380c8 = 0;

    }

    else {

      DAT_008380c8 = FUN_00433d20();

    }

  }

  cVar1 = FUN_00433710(param_1,&local_4);

  if ((((cVar1 != '\0') && (piVar3 = (int *)(**(code **)(*local_4 + 0x44))(), piVar3 != (int *)0x0))

      && (cVar1 = (**(code **)(*piVar3 + 0x48))(), cVar1 != '\0')) && (piVar3[4] == 4)) {

    piStack_8 = (int *)0x0;

    cVar1 = FUN_00437140(param_1,&piStack_8);

    bVar4 = false;

    if (cVar1 != '\0') {

      iVar2 = (**(code **)(*piStack_8 + 0x44))();

      bVar4 = iVar2 != 0;

      if ((bVar4) && (iVar2 != 0)) {

        FUN_00437640(&stack0x00000008);

      }

    }

    return bVar4;

  }

  return false;

}





// --- FUN_00437c60 at 0x00437C60 (size: 179) ---


bool FUN_00437c60(undefined4 param_1)



{

  char cVar1;

  int iVar2;

  int *piVar3;

  bool bVar4;

  int *piStack_8;

  int *local_4;

  

  if (DAT_008380c8 == 0) {

    iVar2 = FUN_005df0f5(0x8100);

    if (iVar2 == 0) {

      DAT_008380c8 = 0;

    }

    else {

      DAT_008380c8 = FUN_00433d20();

    }

  }

  cVar1 = FUN_00433710(param_1,&local_4);

  if ((((cVar1 != '\0') && (piVar3 = (int *)(**(code **)(*local_4 + 0x44))(), piVar3 != (int *)0x0))

      && (cVar1 = (**(code **)(*piVar3 + 0x48))(), cVar1 != '\0')) && (piVar3[4] == 9)) {

    piStack_8 = (int *)0x0;

    cVar1 = FUN_00437140(param_1,&piStack_8);

    bVar4 = false;

    if (cVar1 != '\0') {

      iVar2 = (**(code **)(*piStack_8 + 0x44))();

      bVar4 = iVar2 != 0;

      if ((bVar4) && (iVar2 != 0)) {

        FUN_004376a0(&stack0x00000008);

      }

    }

    return bVar4;

  }

  return false;

}





// --- FUN_00437d20 at 0x00437D20 (size: 179) ---


bool FUN_00437d20(undefined4 param_1,undefined4 param_2)



{

  char cVar1;

  int iVar2;

  int *piVar3;

  bool bVar4;

  int *piStack_8;

  int *local_4;

  

  if (DAT_008380c8 == 0) {

    iVar2 = FUN_005df0f5(0x8100);

    if (iVar2 == 0) {

      DAT_008380c8 = 0;

    }

    else {

      DAT_008380c8 = FUN_00433d20();

    }

  }

  cVar1 = FUN_00433710(param_1,&local_4);

  if ((((cVar1 != '\0') && (piVar3 = (int *)(**(code **)(*local_4 + 0x44))(), piVar3 != (int *)0x0))

      && (cVar1 = (**(code **)(*piVar3 + 0x48))(), cVar1 != '\0')) && (piVar3[4] == 0xd)) {

    piStack_8 = (int *)0x0;

    cVar1 = FUN_00437140(param_1,&piStack_8);

    bVar4 = false;

    if (cVar1 != '\0') {

      iVar2 = (**(code **)(*piStack_8 + 0x44))();

      bVar4 = iVar2 != 0;

      if ((bVar4) && (iVar2 != 0)) {

        FUN_00437700(param_2);

      }

    }

    return bVar4;

  }

  return false;

}





// --- FUN_00437de0 at 0x00437DE0 (size: 179) ---


bool FUN_00437de0(undefined4 param_1,undefined4 param_2)



{

  char cVar1;

  int iVar2;

  int *piVar3;

  bool bVar4;

  int *piStack_8;

  int *local_4;

  

  if (DAT_008380c8 == 0) {

    iVar2 = FUN_005df0f5(0x8100);

    if (iVar2 == 0) {

      DAT_008380c8 = 0;

    }

    else {

      DAT_008380c8 = FUN_00433d20();

    }

  }

  cVar1 = FUN_00433710(param_1,&local_4);

  if ((((cVar1 != '\0') && (piVar3 = (int *)(**(code **)(*local_4 + 0x44))(), piVar3 != (int *)0x0))

      && (cVar1 = (**(code **)(*piVar3 + 0x48))(), cVar1 != '\0')) && (piVar3[4] == 0xd)) {

    piStack_8 = (int *)0x0;

    cVar1 = FUN_00437140(param_1,&piStack_8);

    bVar4 = false;

    if (cVar1 != '\0') {

      iVar2 = (**(code **)(*piStack_8 + 0x44))();

      bVar4 = iVar2 != 0;

      if ((bVar4) && (iVar2 != 0)) {

        FUN_004377a0(param_2);

      }

    }

    return bVar4;

  }

  return false;

}





// --- FUN_00437ea0 at 0x00437EA0 (size: 191) ---


undefined4 __thiscall FUN_00437ea0(int *param_1,uint param_2)



{

  uint *puVar1;

  int iVar2;

  uint *puVar3;

  

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

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

      return 1;

    }

    if (param_2 == 0) {

      FUN_00437940();

      return 1;

    }

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

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

      puVar1 = puVar3 + 1;

      *puVar3 = param_2;

      FUN_00401000(puVar1,8,param_2,&LAB_00437910);

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

        if (*param_1 != 0) {

          iVar2 = param_1[2];

          while (iVar2 = iVar2 + -1, -1 < iVar2) {

            FUN_00437890(*param_1 + iVar2 * 8);

          }

          if (((param_1[1] & 0x80000000U) == 0x80000000) && (*param_1 != 0)) {

            FUN_004377f0(3);

          }

        }

        *param_1 = (int)puVar1;

        param_1[1] = param_2 | 0x80000000;

        return 1;

      }

    }

  }

  return 0;

}





// --- FUN_00437f60 at 0x00437F60 (size: 125) ---


void FUN_00437f60(void)



{

  LONG LVar1;

  undefined4 *puVar2;

  int local_4;

  

  FUN_00401340("LoadPreferences");

  FUN_00436830(&local_4);

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

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

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

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

  }

  FUN_00401340("SavePreferences");

  FUN_00436830(&local_4);

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

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

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

  }

  return;

}





// --- FUN_00437fe0 at 0x00437FE0 (size: 578) ---


undefined1 FUN_00437fe0(int *param_1)



{

  undefined *puVar1;

  undefined1 uVar2;

  LONG LVar3;

  int iVar4;

  LONG *lpAddend;

  int unaff_EBX;

  undefined4 *puVar5;

  code *pcVar6;

  undefined *local_14;

  int local_10;

  undefined *local_c;

  undefined *local_8;

  int local_4;

  

  FUN_00401340("UserPreferences.ini");

  local_14 = PTR_DAT_00818344;

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

  if (*(int *)(DAT_00838188 + -4) == 1) {

    if ((DAT_00818afc == '\0') || (DAT_00837cd0 == '\0')) {

      local_c = PTR_DAT_00818344;

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

      FUN_0040c230(&local_4);

      thunk_FUN_0040c780(&local_c,&local_4);

      FUN_00402710(&local_14,&DAT_00799b90,local_c,local_10);

      thunk_FUN_0040da10(&local_14,0);

      pcVar6 = InterlockedDecrement_exref;

      puVar1 = (undefined *)*param_1;

      if (puVar1 != local_14) {

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

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

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

        }

        *param_1 = (int)local_14;

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

      }

      uVar2 = FUN_0040b320(&local_14,0);

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

      local_8 = local_c;

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

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

        local_8 = local_c;

      }

    }

    else {

      FUN_00423430(&local_8,&DAT_00838168);

      FUN_00402710(&local_14,"%s\\%s",local_8,local_10);

      thunk_FUN_0040da10(&local_14,0);

      FUN_00402070(&local_14);

      uVar2 = FUN_0040b320(&local_14,0);

      pcVar6 = InterlockedDecrement_exref;

    }

    iVar4 = (*pcVar6)(local_8 + -0x10);

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

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

    }

    iVar4 = (*pcVar6)(unaff_EBX + -0x10);

    if ((iVar4 == 0) && ((undefined4 *)(unaff_EBX + -0x14) != (undefined4 *)0x0)) {

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

    }

    iVar4 = (*pcVar6)(unaff_EBX + -0x10);

    local_10 = unaff_EBX;

  }

  else {

    iVar4 = *param_1;

    if (iVar4 != DAT_00838188) {

      LVar3 = InterlockedDecrement((LONG *)(iVar4 + -0x10));

      if ((LVar3 == 0) && ((undefined4 *)(iVar4 + -0x14) != (undefined4 *)0x0)) {

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

      }

      lpAddend = (LONG *)(DAT_00838188 + -0x10);

      *param_1 = DAT_00838188;

      InterlockedIncrement(lpAddend);

    }

    uVar2 = FUN_0040b320(param_1,0);

    puVar5 = (undefined4 *)(local_14 + -0x14);

    LVar3 = InterlockedDecrement((LONG *)(local_14 + -0x10));

    if ((LVar3 == 0) && (puVar5 != (undefined4 *)0x0)) {

      (**(code **)*puVar5)(1);

    }

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

  }

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

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

  }

  return uVar2;

}





// --- FUN_00438230 at 0x00438230 (size: 1155) ---


undefined1 FUN_00438230(void)



{

  uint uVar1;

  uint uVar2;

  undefined *puVar3;

  char cVar4;

  char cVar5;

  LONG LVar6;

  int iVar7;

  int *piVar8;

  int iVar9;

  undefined4 uVar10;

  int *piVar11;

  uint uVar12;

  uint uVar13;

  code *pcVar14;

  undefined4 *puVar15;

  int iVar16;

  LPCSTR lpKeyName;

  LPCSTR pCVar17;

  LPCSTR pCVar18;

  undefined4 uStack_3c;

  LPCSTR pCStack_38;

  LPCSTR local_34;

  undefined *local_30;

  uint uStack_2c;

  LPCSTR pCStack_28;

  int *piStack_24;

  int iStack_20;

  int iStack_1c;

  void *local_18;

  uint local_14;

  uint local_10;

  undefined1 auStack_c [12];

  

  local_34 = PTR_DAT_00818344;

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

  cVar4 = FUN_00437fe0(&local_34);

  uStack_3c = (LPCSTR)CONCAT13(cVar4,(undefined3)uStack_3c);

  if (cVar4 == '\0') {

    uStack_3c._3_1_ = 0;

    if (*(int *)(local_34 + -4) == 1) goto LAB_0043868f;

    local_30 = PTR_DAT_00818344;

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

    cVar5 = thunk_FUN_0040c780(&local_30,&local_34);

    cVar4 = '\0';

    if (cVar5 != '\0') {

      cVar4 = thunk_FUN_0040df20(&local_30);

    }

    uStack_3c = (LPCSTR)CONCAT13(cVar4,(undefined3)uStack_3c);

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

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

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

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

    }

    if (cVar4 != '\0') goto LAB_004382d9;

  }

  else {

LAB_004382d9:

    local_18 = (void *)0x0;

    local_14 = 0;

    local_10 = 0;

    if (DAT_008380c8 == 0) {

      iVar7 = FUN_005df0f5(0x8100);

      if (iVar7 == 0) {

        DAT_008380c8 = 0;

      }

      else {

        DAT_008380c8 = FUN_00433d20();

      }

    }

    piVar8 = (int *)FUN_0052dcf0(auStack_c);

    iVar7 = *piVar8;

    piVar11 = (int *)piVar8[1];

    iVar16 = piVar8[2];

    if (DAT_008380c8 == 0) {

      iVar9 = FUN_005df0f5(0x8100);

      if (iVar9 == 0) {

        DAT_008380c8 = 0;

      }

      else {

        DAT_008380c8 = FUN_00433d20();

      }

    }

    while (iVar16 != 0) {

      do {

        piVar8 = (int *)(**(code **)(**(int **)(iVar16 + 8) + 0x30))();

        if ((piVar8 != (int *)0x0) && (cVar4 = (**(code **)(*piVar8 + 0x48))(), cVar4 != '\0')) {

          if ((local_14 & 0x7fffffff) <= local_10) {

            uVar10 = FUN_00453850((local_14 & 0x7fffffff) + 1);

            cVar4 = FUN_004180a0(uVar10);

            if (cVar4 == '\0') goto LAB_004383b3;

          }

          *(int **)((int)local_18 + local_10 * 4) = piVar8;

          local_10 = local_10 + 1;

        }

LAB_004383b3:

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

      } while (iVar16 != 0);

      do {

        piVar11 = piVar11 + 1;

        if (piVar11 == (int *)(*(int *)(iVar7 + 0x60) + *(int *)(iVar7 + 0x68) * 4))

        goto LAB_004383d6;

        iVar16 = *piVar11;

      } while (iVar16 == 0);

    }

LAB_004383d6:

    uStack_2c = 0;

    if (local_10 != 0) {

      do {

        piStack_24 = *(int **)((int)local_18 + uStack_2c * 4);

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

          pCVar17 = (LPCSTR)piStack_24[1];

          pCStack_28 = pCVar17;

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

          lpKeyName = PTR_DAT_00818344;

          uVar1 = *(uint *)(pCVar17 + -4);

          if (uVar1 < 2) {

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

          }

          else {

            for (uVar12 = uVar1 - 2; uVar13 = 0xffffffff, -1 < (int)uVar12; uVar12 = uVar12 - 1) {

              uVar2 = uVar1 - 1;

              if (uVar12 < uVar1) {

                uVar2 = uVar12;

              }

              uVar13 = uVar12;

              if (pCVar17[uVar2] == '.') break;

            }

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

            puVar3 = PTR_DAT_00818344;

            pCStack_38 = PTR_DAT_00818344;

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

            if ((int)uVar13 < 1) {

              if (lpKeyName != pCVar17) {

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

                if ((LVar6 == 0) && (lpKeyName + -0x14 != (LPCSTR)0x0)) {

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

                }

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

                lpKeyName = pCVar17;

              }

              FUN_00405000("Default");

              pcVar14 = InterlockedDecrement_exref;

LAB_004385a2:

              local_30 = PTR_DAT_00818344;

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

              (**(code **)(*piStack_24 + 0x4c))(&local_30);

              WritePrivateProfileStringA(uStack_3c,lpKeyName,local_34,pCStack_38);

              pCVar18 = local_34 + -0x14;

              iVar7 = (*pcVar14)(local_34 + -0x10);

              if ((iVar7 == 0) && (pCVar18 != (LPCSTR)0x0)) {

                (*(code *)**(undefined4 **)pCVar18)(1);

              }

            }

            else {

              pcVar14 = InterlockedDecrement_exref;

              if ((int)uVar13 < *(int *)(pCVar17 + -4) + -2) {

                piVar11 = (int *)FUN_00404f80(&iStack_20,uVar13 + 1,*(int *)(pCVar17 + -4) + -2);

                if (lpKeyName != (undefined *)*piVar11) {

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

                  if ((LVar6 == 0) && (lpKeyName + -0x14 != (LPCSTR)0x0)) {

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

                  }

                  lpKeyName = (LPCSTR)*piVar11;

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

                }

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

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

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

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

                }

                piVar11 = (int *)FUN_00404f80(&iStack_1c,0,uVar13 - 1);

                if (puVar3 != (undefined *)*piVar11) {

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

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

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

                  }

                  pCStack_38 = (LPCSTR)*piVar11;

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

                }

                pcVar14 = InterlockedDecrement_exref;

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

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

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

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

                }

                goto LAB_004385a2;

              }

            }

            iVar7 = (*pcVar14)(pCStack_38 + -0x10);

            if ((iVar7 == 0) && (pCStack_38 + -0x14 != (LPCSTR)0x0)) {

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

            }

            iVar7 = (*pcVar14)(lpKeyName + -0x10);

            if ((iVar7 == 0) && (lpKeyName + -0x14 != (LPCSTR)0x0)) {

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

            }

            iVar7 = (*pcVar14)(pCVar17 + -0x10);

          }

          if ((iVar7 == 0) && (pCVar17 + -0x14 != (LPCSTR)0x0)) {

            (*(code *)**(undefined4 **)(pCVar17 + -0x14))(1);

          }

        }

        uStack_2c = uStack_2c + 1;

      } while (uStack_2c < local_10);

    }

    if ((local_14 & 0x80000000) == 0x80000000) {

      operator_delete__(local_18);

    }

  }

LAB_0043868f:

  pCVar17 = local_34 + -0x14;

  LVar6 = InterlockedDecrement((LONG *)(local_34 + -0x10));

  if ((LVar6 == 0) && (pCVar17 != (LPCSTR)0x0)) {

    (*(code *)**(undefined4 **)pCVar17)(1);

  }

  return uStack_3c._3_1_;

}





// --- FUN_00438750 at 0x00438750 (size: 260) ---


bool FUN_00438750(undefined4 param_1,int *param_2)



{

  int iVar1;

  char cVar2;

  int iVar3;

  int *piVar4;

  undefined4 uVar5;

  bool bVar6;

  int *piStack_8;

  int *local_4;

  

  if (DAT_008380c8 == 0) {

    iVar3 = FUN_005df0f5(0x8100);

    if (iVar3 == 0) {

      DAT_008380c8 = 0;

    }

    else {

      DAT_008380c8 = FUN_00433d20();

    }

  }

  cVar2 = FUN_00433710(param_1,&local_4);

  if ((((cVar2 == '\0') || (piVar4 = (int *)(**(code **)(*local_4 + 0x44))(), piVar4 == (int *)0x0))

      || (cVar2 = (**(code **)(*piVar4 + 0x48))(), cVar2 == '\0')) || (piVar4[4] != 4)) {

    return false;

  }

  piStack_8 = (int *)0x0;

  cVar2 = FUN_00437140(param_1,&piStack_8);

  bVar6 = false;

  if (cVar2 != '\0') {

    iVar3 = (**(code **)(*piStack_8 + 0x44))();

    bVar6 = iVar3 != 0;

    if ((bVar6) && (iVar3 != 0)) {

      piStack_8 = *(int **)(iVar3 + 0x24);

      piVar4 = (int *)0x0;

      if (piStack_8 != (int *)0x0) {

        do {

          iVar1 = *(int *)(iVar3 + 0x20);

          if ((uint)param_2[2] < (param_2[1] & 0x7fffffffU)) {

LAB_00438834:

            *(undefined4 *)(*param_2 + param_2[2] * 4) = *(undefined4 *)(iVar1 + (int)piVar4 * 4);

            param_2[2] = param_2[2] + 1;

          }

          else {

            uVar5 = FUN_00453850((param_2[1] & 0x7fffffffU) + 1);

            cVar2 = FUN_004180a0(uVar5);

            if (cVar2 != '\0') goto LAB_00438834;

          }

          piVar4 = (int *)((int)piVar4 + 1);

        } while (piVar4 < piStack_8);

      }

    }

  }

  return bVar6;

}





// --- FUN_00438860 at 0x00438860 (size: 209) ---


bool FUN_00438860(undefined4 param_1)



{

  uint uVar1;

  char cVar2;

  int iVar3;

  int *piVar4;

  uint uVar5;

  bool bVar6;

  int *piStack_8;

  int *local_4;

  

  if (DAT_008380c8 == 0) {

    iVar3 = FUN_005df0f5(0x8100);

    if (iVar3 == 0) {

      DAT_008380c8 = 0;

    }

    else {

      DAT_008380c8 = FUN_00433d20();

    }

  }

  cVar2 = FUN_00433710(param_1,&local_4);

  if (cVar2 != '\0') {

    piVar4 = (int *)(**(code **)(*local_4 + 0x44))();

    if (((piVar4 != (int *)0x0) && (cVar2 = (**(code **)(*piVar4 + 0x48))(), cVar2 != '\0')) &&

       (piVar4[4] == 4)) {

      piStack_8 = (int *)0x0;

      cVar2 = FUN_00437140(param_1,&piStack_8);

      bVar6 = false;

      if (cVar2 != '\0') {

        iVar3 = (**(code **)(*piStack_8 + 0x44))();

        bVar6 = iVar3 != 0;

        if ((bVar6) && (iVar3 != 0)) {

          uVar1 = *(uint *)(iVar3 + 0x1c);

          uVar5 = 0;

          if (uVar1 != 0) {

            do {

              FUN_0040c440(*(int *)(iVar3 + 0x18) + uVar5 * 4);

              uVar5 = uVar5 + 1;

            } while (uVar5 < uVar1);

            bVar6 = true;

          }

        }

      }

      return bVar6;

    }

  }

  return false;

}





// --- FUN_00438940 at 0x00438940 (size: 1544) ---


char FUN_00438940(void)



{

  undefined *puVar1;

  char cVar2;

  char cVar3;

  LPSTR pCVar4;

  DWORD DVar5;

  LONG LVar6;

  undefined4 uVar7;

  int iVar8;

  LPCSTR pCVar9;

  int *piVar10;

  undefined4 *puVar11;

  uint uVar12;

  LPSTR pCVar13;

  LPCSTR local_64;

  undefined *local_60;

  undefined *local_5c;

  int local_58;

  undefined *local_54;

  uint local_50;

  uint local_4c;

  LPSTR local_48;

  undefined *local_44;

  undefined *local_40;

  int local_3c;

  uint local_38;

  uint local_34;

  int local_30;

  uint local_2c;

  uint local_28;

  int local_24;

  uint local_20;

  uint local_1c;

  undefined **local_18;

  int *local_14;

  undefined4 local_10;

  uint local_c;

  

  local_64 = PTR_DAT_00818344;

  DAT_00818afd = 0;

  InterlockedIncrement((LONG *)(PTR_DAT_00818344 + -0x10));

  cVar2 = FUN_00437fe0(&local_64);

  if (cVar2 == '\0') {

LAB_00438e74:

    pCVar9 = local_64 + -0x14;

    LVar6 = InterlockedDecrement((LONG *)(local_64 + -0x10));

    if ((LVar6 == 0) && (pCVar9 != (LPCSTR)0x0)) {

      (*(code *)**(undefined4 **)pCVar9)(1);

    }

    return cVar2;

  }

  local_3c = 0;

  local_38 = 0;

  local_34 = 0;

  pCVar4 = (LPSTR)thunk_FUN_005df0f5(0x4000);

  pCVar13 = pCVar4;

  for (iVar8 = 0x1000; iVar8 != 0; iVar8 = iVar8 + -1) {

    pCVar13[0] = '\0';

    pCVar13[1] = '\0';

    pCVar13[2] = '\0';

    pCVar13[3] = '\0';

    pCVar13 = pCVar13 + 4;

  }

  DVar5 = GetPrivateProfileSectionNamesA(pCVar4,0x4000,local_64);

  if (DVar5 == 0) {

    operator_delete__(pCVar4);

    if (((local_38 & 0x80000000) == 0x80000000) && (local_3c != 0)) {

      FUN_004377f0(3);

    }

  }

  else {

    local_30 = 0;

    local_2c = 0;

    local_28 = 0;

    cVar3 = FUN_0040caf0(pCVar4,DVar5,&local_30);

    if (cVar3 != '\0') {

      operator_delete__(pCVar4);

      local_48 = (LPSTR)thunk_FUN_005df0f5(0x4000);

      local_4c = 0;

      if (local_28 != 0) {

        do {

          pCVar9 = *(LPCSTR *)(local_30 + local_4c * 4);

          InterlockedIncrement((LONG *)(pCVar9 + -0x10));

          pCVar13 = local_48;

          pCVar4 = local_48;

          for (iVar8 = 0x1000; iVar8 != 0; iVar8 = iVar8 + -1) {

            pCVar4[0] = '\0';

            pCVar4[1] = '\0';

            pCVar4[2] = '\0';

            pCVar4[3] = '\0';

            pCVar4 = pCVar4 + 4;

          }

          DVar5 = GetPrivateProfileSectionA(pCVar9,local_48,0x4000,local_64);

          if (DVar5 != 0) {

            local_24 = 0;

            local_20 = 0;

            local_1c = 0;

            cVar3 = FUN_0040caf0(pCVar13,DVar5,&local_24);

            if (cVar3 == '\0') {

              operator_delete__(pCVar13);

              if (((local_20 & 0x80000000) == 0x80000000) && (local_24 != 0)) {

                FUN_00407920(3);

              }

              LVar6 = InterlockedDecrement((LONG *)(pCVar9 + -0x10));

              if ((LVar6 == 0) && (pCVar9 + -0x14 != (LPCSTR)0x0)) {

                (*(code *)**(undefined4 **)(pCVar9 + -0x14))(1);

              }

              if (((local_2c & 0x80000000) == 0x80000000) && (local_30 != 0)) {

                FUN_00407920(3);

              }

              if (((local_38 & 0x80000000) == 0x80000000) && (local_3c != 0)) {

                FUN_004377f0(3);

              }

              pCVar9 = local_64 + -0x14;

              LVar6 = InterlockedDecrement((LONG *)(local_64 + -0x10));

              if ((LVar6 == 0) && (pCVar9 != (LPCSTR)0x0)) {

                (*(code *)**(undefined4 **)pCVar9)(1);

              }

              return '\0';

            }

            local_50 = 0;

            if (local_1c != 0) {

              do {

                local_58 = *(int *)(local_24 + local_50 * 4);

                InterlockedIncrement((LONG *)(local_58 + -0x10));

                local_18 = &PTR_FUN_00795074;

                local_14 = (int *)0x0;

                local_10 = 0;

                local_c = 0;

                cVar3 = thunk_FUN_0040c2d0(&local_58,0x3d,&local_18);

                if (cVar3 == '\0') {

LAB_00438d2c:

                  local_18 = &PTR_FUN_00795074;

                  FUN_00405210();

                  puVar11 = (undefined4 *)(local_58 + -0x14);

                  LVar6 = InterlockedDecrement((LONG *)(local_58 + -0x10));

                  if ((LVar6 == 0) && (puVar11 != (undefined4 *)0x0)) {

                    (**(code **)*puVar11)(1);

                  }

                }

                else {

                  local_5c = PTR_DAT_00818344;

                  InterlockedIncrement((LONG *)(PTR_DAT_00818344 + -0x10));

                  local_60 = PTR_DAT_00818344;

                  InterlockedIncrement((LONG *)(PTR_DAT_00818344 + -0x10));

                  if (local_c == 2) {

                    FUN_00405120(&local_5c);

                    FUN_00405120(&local_60);

LAB_00438c05:

                    local_54 = PTR_DAT_00818344;

                    InterlockedIncrement((LONG *)(PTR_DAT_00818344 + -0x10));

                    puVar1 = local_5c;

                    FUN_00402710(&local_54,"%s.%s",pCVar9,local_5c);

                    local_44 = local_54;

                    InterlockedIncrement((LONG *)(local_54 + -0x10));

                    local_40 = local_60;

                    InterlockedIncrement((LONG *)(local_60 + -0x10));

                    if (local_34 < (local_38 & 0x7fffffff)) {

LAB_00438c72:

                      FUN_00437890(&local_44);

                      local_34 = local_34 + 1;

                    }

                    else {

                      uVar7 = FUN_00453850((local_38 & 0x7fffffff) + 1);

                      cVar3 = FUN_00437ea0(uVar7);

                      if (cVar3 != '\0') goto LAB_00438c72;

                    }

                    puVar11 = (undefined4 *)(local_40 + -0x14);

                    LVar6 = InterlockedDecrement((LONG *)(local_40 + -0x10));

                    if ((LVar6 == 0) && (puVar11 != (undefined4 *)0x0)) {

                      (**(code **)*puVar11)(1);

                    }

                    puVar11 = (undefined4 *)(local_44 + -0x14);

                    LVar6 = InterlockedDecrement((LONG *)(local_44 + -0x10));

                    if ((LVar6 == 0) && (puVar11 != (undefined4 *)0x0)) {

                      (**(code **)*puVar11)(1);

                    }

                    puVar11 = (undefined4 *)(local_54 + -0x14);

                    LVar6 = InterlockedDecrement((LONG *)(local_54 + -0x10));

                    if ((LVar6 == 0) && (puVar11 != (undefined4 *)0x0)) {

                      (**(code **)*puVar11)(1);

                    }

                    puVar11 = (undefined4 *)(local_60 + -0x14);

                    LVar6 = InterlockedDecrement((LONG *)(local_60 + -0x10));

                    if ((LVar6 == 0) && (puVar11 != (undefined4 *)0x0)) {

                      (**(code **)*puVar11)(1);

                    }

                    puVar11 = (undefined4 *)(puVar1 + -0x14);

                    LVar6 = InterlockedDecrement((LONG *)(puVar1 + -0x10));

                    if ((LVar6 == 0) && (puVar11 != (undefined4 *)0x0)) {

                      (**(code **)*puVar11)(1);

                    }

                    goto LAB_00438d2c;

                  }

                  if (2 < local_c) {

                    FUN_00405120(&local_5c);

                    for (piVar10 = local_14; piVar10 != (int *)0x0; piVar10 = (int *)piVar10[1]) {

                      iVar8 = *(int *)(*piVar10 + -4);

                      if (iVar8 != 1) {

                        FUN_00404ef0(*piVar10,iVar8 + -1);

                      }

                    }

                    goto LAB_00438c05;

                  }

                  if (local_c == 1) {

                    FUN_00405120(&local_5c);

                    FUN_00405000(&DAT_007938af);

                    goto LAB_00438c05;

                  }

                  FUN_004011b0();

                  FUN_004011b0();

                  local_18 = &PTR_FUN_00795074;

                  FUN_00405210();

                  FUN_004011b0();

                }

                local_50 = local_50 + 1;

              } while (local_50 < local_1c);

            }

            if (((local_20 & 0x80000000) == 0x80000000) && (local_24 != 0)) {

              FUN_00407920(3);

            }

          }

          LVar6 = InterlockedDecrement((LONG *)(pCVar9 + -0x10));

          if ((LVar6 == 0) && (pCVar9 + -0x14 != (LPCSTR)0x0)) {

            (*(code *)**(undefined4 **)(pCVar9 + -0x14))(1);

          }

          local_4c = local_4c + 1;

        } while (local_4c < local_28);

      }

      operator_delete__(local_48);

      uVar12 = 0;

      if (local_34 != 0) {

        do {

          iVar8 = local_3c + uVar12 * 8;

          FUN_00436ec0(iVar8,iVar8 + 4);

          uVar12 = uVar12 + 1;

        } while (uVar12 < local_34);

      }

      if (((local_2c & 0x80000000) == 0x80000000) && (local_30 != 0)) {

        FUN_00407920(3);

      }

      if (((local_38 & 0x80000000) == 0x80000000) && (local_3c != 0)) {

        FUN_004377f0(3);

      }

      DAT_00818afd = 1;

      goto LAB_00438e74;

    }

    operator_delete__(pCVar4);

    if (((local_2c & 0x80000000) == 0x80000000) && (local_30 != 0)) {

      FUN_00407920(3);

    }

    if (((local_38 & 0x80000000) == 0x80000000) && (local_3c != 0)) {

      FUN_004377f0(3);

    }

  }

  pCVar9 = local_64 + -0x14;

  LVar6 = InterlockedDecrement((LONG *)(local_64 + -0x10));

  if ((LVar6 == 0) && (pCVar9 != (LPCSTR)0x0)) {

    (*(code *)**(undefined4 **)pCVar9)(1);

  }

  return '\0';

}





// --- FUN_00438fe0 at 0x00438FE0 (size: 342) ---


undefined1 FUN_00438fe0(int param_1,int *param_2)



{

  undefined1 uVar1;

  LONG LVar2;

  undefined4 *puVar3;

  int local_8;

  int local_4;

  

  DAT_00818afc = (undefined1)param_1;

  DAT_00818afd = 1;

  FUN_00401340("Loads user preferences from disk");

  FUN_00401340("LoadPreferences");

  FUN_00436580(&LAB_00438f50,&local_8,&local_4);

  puVar3 = (undefined4 *)(local_8 + -0x14);

  LVar2 = InterlockedDecrement((LONG *)(local_8 + -0x10));

  if ((LVar2 == 0) && (puVar3 != (undefined4 *)0x0)) {

    (**(code **)*puVar3)(1);

  }

  puVar3 = (undefined4 *)(local_4 + -0x14);

  LVar2 = InterlockedDecrement((LONG *)(local_4 + -0x10));

  if ((LVar2 == 0) && (puVar3 != (undefined4 *)0x0)) {

    (**(code **)*puVar3)(1);

  }

  FUN_00401340("Saves user preferences to disk");

  FUN_00401340("SavePreferences");

  FUN_00436580(&LAB_004386c0,&local_4,&local_8);

  LVar2 = InterlockedDecrement((LONG *)(local_4 + -0x10));

  if ((LVar2 == 0) && ((undefined4 *)(local_4 + -0x14) != (undefined4 *)0x0)) {

    (*(code *)**(undefined4 **)(local_4 + -0x14))(1);

  }

  LVar2 = InterlockedDecrement((LONG *)(local_8 + -0x10));

  if ((LVar2 == 0) && ((undefined4 *)(local_8 + -0x14) != (undefined4 *)0x0)) {

    (*(code *)**(undefined4 **)(local_8 + -0x14))(1);

  }

  param_1 = *param_2;

  InterlockedIncrement((LONG *)(param_1 + -0x10));

  if (*(int *)(param_1 + -4) == 1) {

    FUN_00437fe0(&param_1);

  }

  uVar1 = FUN_00437510(&param_1);

  puVar3 = (undefined4 *)(param_1 + -0x14);

  LVar2 = InterlockedDecrement((LONG *)(param_1 + -0x10));

  if ((LVar2 == 0) && (puVar3 != (undefined4 *)0x0)) {

    (**(code **)*puVar3)(1);

  }

  return uVar1;

}





// --- FUN_00439140 at 0x00439140 (size: 43) ---


void __fastcall FUN_00439140(undefined4 *param_1)



{

  *param_1 = 0;

  param_1[1] = 800;

  param_1[2] = 600;

  *(undefined1 *)(param_1 + 3) = 0;

  param_1[4] = 0;

  param_1[5] = 0x20;

  *(undefined1 *)(param_1 + 6) = 0;

  *(undefined1 *)((int)param_1 + 0x19) = 0;

  *(undefined1 *)((int)param_1 + 0x1a) = 0;

  return;

}





// --- FUN_00439170 at 0x00439170 (size: 36) ---


undefined4 * __thiscall FUN_00439170(undefined4 *param_1,byte param_2)



{

  *param_1 = &PTR_FUN_00799d14;

  FUN_00440f40();

  if ((param_2 & 1) != 0) {

    operator_delete(param_1);

  }

  return param_1;

}





// --- FUN_00439210 at 0x00439210 (size: 18) ---


undefined4 * __fastcall FUN_00439210(undefined4 *param_1)



{

  FUN_0040e790();

  *param_1 = &PTR_FUN_00799d18;

  return param_1;

}





// --- FUN_00439230 at 0x00439230 (size: 8) ---


void FUN_00439230(void)



{

  DAT_00838194 = 1;

  return;

}





// --- FUN_00439240 at 0x00439240 (size: 101) ---


undefined4

FUN_00439240(undefined4 param_1,undefined4 param_2,undefined4 param_3,undefined4 param_4,

            undefined1 *param_5)



{

  undefined4 uVar1;

  undefined4 local_1c;

  undefined4 local_18;

  undefined4 local_14;

  undefined4 local_10;

  LONG local_c;

  

  if ((DAT_00838196 != '\0') && (DAT_00837ff4 != (int *)0x0)) {

    local_1c = param_1;

    local_18 = param_2;

    local_14 = param_3;

    local_10 = param_4;

    local_c = GetMessageTime();

    uVar1 = (**(code **)(*DAT_00837ff4 + 0x70))(&local_1c,param_5);

    return uVar1;

  }

  *param_5 = 0;

  return 0;

}





// --- FUN_004392b0 at 0x004392B0 (size: 56) ---


/* WARNING: Globals starting with '_' overlap smaller symbols at the same address */



void FUN_004392b0(void)



{

  DWORD DVar1;

  DWORD dwMilliseconds;

  

  dwMilliseconds = 0;

  if (DAT_00838197 == '\0') {

    DVar1 = timeGetTime();

    if (DVar1 - _DAT_00838314 < 99) {

      dwMilliseconds = 99 - (DVar1 - _DAT_00838314);

    }

  }

  Sleep(dwMilliseconds);

  _DAT_00838314 = timeGetTime();

  return;

}





// --- FUN_004392f0 at 0x004392F0 (size: 34) ---


void FUN_004392f0(void)



{

  if (DAT_00838197 == '\0') {

    if (DAT_00837ff4 != (int *)0x0) {

      (**(code **)(*DAT_00837ff4 + 0x74))(1);

    }

    DAT_00838197 = '\x01';

  }

  return;

}





// --- FUN_00439320 at 0x00439320 (size: 70) ---


void FUN_00439320(void)



{

  HCURSOR hCursor;

  

  if (DAT_00838197 != '\0') {

    DAT_00838197 = '\0';

    if (DAT_00837ff4 != (int *)0x0) {

      (**(code **)(*DAT_00837ff4 + 0x74))(0);

    }

    if ((DAT_00870340 == 0) || (*(char *)(DAT_00870340 + 0x10) == '\0')) {

      hCursor = LoadCursorA((HINSTANCE)0x0,(LPCSTR)0x7f00);

      SetCursor(hCursor);

    }

  }

  return;

}





// --- FUN_00439370 at 0x00439370 (size: 136) ---


undefined4 FUN_00439370(int param_1)



{

  uint uVar1;

  

  uVar1 = DAT_00818b64 & 0xffff;

  if ((799 < DAT_00818b64 >> 0x10) && (599 < uVar1)) {

    *(uint *)(param_1 + 4) = DAT_00818b64 >> 0x10;

    *(uint *)(param_1 + 8) = uVar1;

    *(undefined1 *)(param_1 + 0xc) = DAT_00818b68;

    *(undefined4 *)(param_1 + 0x10) = DAT_00818b6c;

    *(undefined1 *)(param_1 + 0x18) = DAT_00818b70;

    *(undefined1 *)(param_1 + 0x19) = DAT_00818b71;

    *(undefined1 *)(param_1 + 0x1a) = DAT_00818b72;

    if (DAT_008381a0 != '\0') {

      *(undefined4 *)(param_1 + 4) = DAT_00818b04;

      *(undefined4 *)(param_1 + 8) = DAT_00818b08;

    }

    if (DAT_00818b02 == '\0') {

      *(undefined1 *)(param_1 + 0xc) = 0;

    }

    return 1;

  }

  return 0;

}





// --- FUN_00439400 at 0x00439400 (size: 82) ---


undefined4 FUN_00439400(void)



{

  HCURSOR hCursor;

  

  if (DAT_00838197 != '\0') {

    DAT_00838197 = '\0';

    if (DAT_00837ff4 != (int *)0x0) {

      (**(code **)(*DAT_00837ff4 + 0x74))(0);

    }

    if ((DAT_00870340 == 0) || (*(char *)(DAT_00870340 + 0x10) == '\0')) {

      hCursor = LoadCursorA((HINSTANCE)0x0,(LPCSTR)0x7f00);

      SetCursor(hCursor);

    }

  }

  FUN_0043fdd0();

  FUN_0054d190();

  return 1;

}





// --- FUN_00439460 at 0x00439460 (size: 298) ---


int * FUN_00439460(void)



{

  int *piVar1;

  int *piVar2;

  tagPOINT tStack_44;

  tagRECT tStack_3c;

  undefined **appuStack_2c [3];

  int iStack_20;

  int iStack_1c;

  int iStack_18;

  int iStack_14;

  

  piVar1 = (int *)(**(code **)(*DAT_00870340 + 0x3c))();

  if (piVar1 == (int *)0x0) {

    return (int *)0x0;

  }

  if ((char)DAT_00870340[4] == '\0') {

    tStack_44.y = 0;

    tStack_44.x = 0;

    ClientToScreen(DAT_008381a4,&tStack_44);

    GetClientRect(DAT_008381a4,&tStack_3c);

    tStack_3c.top = tStack_3c.top + tStack_44.y;

    tStack_3c.bottom = tStack_3c.bottom + tStack_44.y;

    tStack_3c.left = tStack_3c.left + tStack_44.x;

    tStack_3c.right = tStack_3c.right + tStack_44.x;

    FUN_00441d00(piVar1,&tStack_3c);

    piVar2 = (int *)tStack_44.x;

    if (((iStack_18 - iStack_20 != 0) && (iStack_14 - iStack_1c != 0)) &&

       (piVar2 = (int *)(**(code **)(*DAT_00870340 + 0x10))(), piVar2 != (int *)0x0)) {

      (**(code **)(*piVar2 + 0x58))(iStack_18 - iStack_20,iStack_14 - iStack_1c,piVar1[0x37],1);

      FUN_00443290(appuStack_2c);

    }

    appuStack_2c[0] = &PTR_FUN_00799d14;

    FUN_00440f40();

    (**(code **)(*piVar1 + 0x14))();

    return piVar2;

  }

  (**(code **)(*piVar1 + 0x10))();

  (**(code **)(*piVar1 + 0x14))();

  return piVar1;

}





// --- FUN_00439590 at 0x00439590 (size: 62) ---


undefined4 FUN_00439590(undefined4 *param_1,undefined4 *param_2,char param_3)



{

  char *pcVar1;

  

  pcVar1 = "fatal";

  if (param_3 == '\0') {

    pcVar1 = "non-fatal";

  }

  FUN_0065aef0("%s: %s (%s)\n",*param_2,*param_1,pcVar1);

  if (param_3 != '\0') {

    DAT_00838194 = 1;

  }

  return 0;

}





// --- FUN_004395d0 at 0x004395D0 (size: 79) ---


undefined4 FUN_004395d0(HCURSOR param_1)



{

  HICON hIcon;

  

  if ((param_1 == (HCURSOR)0x0) &&

     (param_1 = LoadCursorA((HINSTANCE)0x0,(LPCSTR)0x7f00), param_1 == (HCURSOR)0x0)) {

    return 1;

  }

  hIcon = (HICON)GetClassLongA(DAT_008381a4,-0xc);

  if (hIcon != param_1) {

    DestroyIcon(hIcon);

  }

  SetClassLongA(DAT_008381a4,-0xc,(LONG)param_1);

  SetCursor(param_1);

  return 1;

}





// --- FUN_00439620 at 0x00439620 (size: 32) ---


void FUN_00439620(byte param_1)



{

  if (DAT_00818b0c != param_1) {

    ShowCursor((uint)param_1);

    DAT_00818b0c = param_1;

  }

  return;

}





// --- FUN_00439640 at 0x00439640 (size: 118) ---


void __fastcall FUN_00439640(int *param_1)



{

  uint uVar1;

  int iVar2;

  undefined4 *puVar3;

  undefined4 local_10;

  undefined4 local_c;

  undefined4 local_8;

  undefined4 local_4;

  

  param_1[2] = 0;

  if ((param_1[1] & 0x80000000U) != 0x80000000) {

    if (*param_1 != 0) {

      uVar1 = param_1[1] & 0x7fffffff;

      if (-1 < (int)(uVar1 - 1)) {

        iVar2 = (uVar1 - 1) * 0x10;

        do {

          puVar3 = (undefined4 *)(*param_1 + iVar2);

          *puVar3 = local_10;

          puVar3[1] = local_c;

          puVar3[2] = local_8;

          iVar2 = iVar2 + -0x10;

          uVar1 = uVar1 - 1;

          puVar3[3] = local_4;

        } while (uVar1 != 0);

      }

    }

    return;

  }

  operator_delete__((void *)*param_1);

  *param_1 = 0;

  param_1[1] = 0;

  return;

}





// --- FUN_004396c0 at 0x004396C0 (size: 80) ---


void FUN_004396c0(undefined4 *param_1,undefined4 param_2,undefined4 param_3,uint param_4,

                 undefined4 param_5)



{

  uint uVar1;

  

  uVar1 = param_1[-2];

  while (param_4 < uVar1) {

    *param_1 = param_1[-4];

    param_1[1] = param_1[-3];

    param_1[2] = param_1[-2];

    param_1[3] = param_1[-1];

    uVar1 = param_1[-6];

    param_1 = param_1 + -4;

  }

  *param_1 = param_2;

  param_1[1] = param_3;

  param_1[2] = param_4;

  param_1[3] = param_5;

  return;

}





// --- FUN_00439710 at 0x00439710 (size: 74) ---


void FUN_00439710(int param_1,int param_2,int param_3,uint param_4)



{

  uint uVar1;

  int iVar2;

  

  if (param_2 <= param_3) {

    *(uint *)(param_1 + param_2 * 4) = param_4;

    return;

  }

  do {

    iVar2 = (param_2 + -1) / 2;

    uVar1 = *(uint *)(param_1 + iVar2 * 4);

    if (param_4 <= uVar1) break;

    *(uint *)(param_1 + param_2 * 4) = uVar1;

    param_2 = iVar2;

  } while (param_3 < iVar2);

  *(uint *)(param_1 + param_2 * 4) = param_4;

  return;

}





// --- FUN_00439760 at 0x00439760 (size: 119) ---


void FUN_00439760(int param_1,int param_2,int param_3,undefined4 param_4,undefined4 param_5,

                 uint param_6,undefined4 param_7)



{

  int iVar1;

  int iVar2;

  undefined4 *puVar3;

  undefined4 *puVar4;

  

  while (param_3 < param_2) {

    iVar1 = (param_2 + -1) / 2;

    iVar2 = iVar1 * 0x10;

    puVar3 = (undefined4 *)(iVar2 + param_1);

    if (param_6 <= *(uint *)(iVar2 + 8 + param_1)) break;

    puVar4 = (undefined4 *)(param_2 * 0x10 + param_1);

    *puVar4 = *puVar3;

    puVar4[1] = puVar3[1];

    puVar4[2] = puVar3[2];

    puVar4[3] = puVar3[3];

    param_2 = iVar1;

  }

  puVar3 = (undefined4 *)(param_2 * 0x10 + param_1);

  *puVar3 = param_4;

  puVar3[1] = param_5;

  puVar3[2] = param_6;

  puVar3[3] = param_7;

  return;

}





// --- FUN_004397e0 at 0x004397E0 (size: 77) ---


undefined4 * FUN_004397e0(int param_1,undefined4 *param_2,undefined4 *param_3)



{

  int iVar1;

  undefined4 *puVar2;

  

  iVar1 = (int)param_2 - param_1 >> 4;

  if (iVar1 < 1) {

    return param_3;

  }

  do {

    puVar2 = param_3 + -4;

    iVar1 = iVar1 + -1;

    *puVar2 = param_2[-4];

    param_3[-3] = param_2[-3];

    param_3[-2] = param_2[-2];

    param_3[-1] = param_2[-1];

    param_3 = puVar2;

    param_2 = param_2 + -4;

  } while (iVar1 != 0);

  return puVar2;

}





// --- FUN_00439840 at 0x00439840 (size: 30) ---


void * __thiscall FUN_00439840(void *param_1,byte param_2)



{

  FUN_0040e6e0();

  if ((param_2 & 1) != 0) {

    operator_delete(param_1);

  }

  return param_1;

}





// --- FUN_00439d50 at 0x00439D50 (size: 243) ---


void FUN_00439d50(undefined1 *param_1)



{

  undefined4 *puVar1;

  int iVar2;

  undefined1 *puVar3;

  HGLOBAL hMem;

  LPVOID pvVar4;

  undefined2 *puVar5;

  LONG LVar6;

  uint uVar7;

  undefined1 *puVar8;

  undefined2 *puVar9;

  undefined1 *puVar10;

  int iVar11;

  bool bVar12;

  

  puVar3 = param_1;

  bVar12 = DAT_0083819c != 2;

  iVar2 = *(int *)(param_1 + -4);

  if (bVar12) {

    hMem = GlobalAlloc(0x42,iVar2 + 1);

    pvVar4 = GlobalLock(hMem);

    uVar7 = 0;

    puVar10 = param_1;

    if (0 < iVar2) {

      do {

        puVar8 = param_1 + *(uint *)(param_1 + -4) * 2 + -2;

        if (uVar7 < *(uint *)(param_1 + -4)) {

          puVar8 = puVar10;

        }

        *(undefined1 *)(uVar7 + (int)pvVar4) = *puVar8;

        uVar7 = uVar7 + 1;

        puVar10 = puVar10 + 2;

      } while ((int)uVar7 < iVar2);

    }

  }

  else {

    hMem = GlobalAlloc(0x42,iVar2 * 2 + 2);

    puVar5 = GlobalLock(hMem);

    uVar7 = 0;

    if (0 < iVar2) {

      iVar11 = (int)param_1 - (int)puVar5;

      do {

        puVar9 = (undefined2 *)(param_1 + *(uint *)(param_1 + -4) * 2 + -2);

        if (uVar7 < *(uint *)(param_1 + -4)) {

          puVar9 = (undefined2 *)((int)puVar5 + iVar11);

        }

        *puVar5 = *puVar9;

        uVar7 = uVar7 + 1;

        puVar5 = puVar5 + 1;

      } while ((int)uVar7 < iVar2);

    }

  }

  param_1 = hMem;

  GlobalUnlock(param_1);

  OpenClipboard(DAT_008381a4);

  EmptyClipboard();

  SetClipboardData((-(uint)bVar12 & 0xfffffff4) + 0xd,param_1);

  CloseClipboard();

  puVar1 = (undefined4 *)(puVar3 + -0x14);

  LVar6 = InterlockedDecrement((LONG *)(puVar3 + -0x10));

  if ((LVar6 == 0) && (puVar1 != (undefined4 *)0x0)) {

    (**(code **)*puVar1)(1);

  }

  return;

}





// --- FUN_00439e50 at 0x00439E50 (size: 213) ---


undefined1 FUN_00439e50(void)



{

  char cVar1;

  int iVar2;

  tagMSG local_1c;

  

  DAT_00838198 = 1;

  iVar2 = PeekMessageA(&local_1c,(HWND)0x0,0,0,1);

  while ((iVar2 != 0 && (local_1c.message != 0x12))) {

    cVar1 = FUN_006a1050(&local_1c);

    if ((cVar1 == '\0') && (iVar2 = FUN_00557a90(local_1c.hwnd,0,&local_1c), iVar2 == 0)) {

      TranslateMessage(&local_1c);

      DispatchMessageA(&local_1c);

    }

    iVar2 = PeekMessageA(&local_1c,(HWND)0x0,0,0,1);

  }

  if (DAT_00838199 != '\0') {

    if ((DAT_0086734c != 0) && (DAT_00838197 != '\0')) {

      if ((DAT_00818b02 == '\0') || (DAT_00818b68 != '\0')) {

        DAT_00818b68 = '\0';

      }

      else {

        DAT_00818b68 = '\x01';

      }

    }

    DAT_00838199 = '\0';

  }

  DAT_00838198 = 0;

  return DAT_00838194;

}





// --- FUN_00439f30 at 0x00439F30 (size: 54) ---


undefined4 FUN_00439f30(undefined4 param_1,undefined4 param_2,undefined4 param_3)



{

  char cVar1;

  undefined4 local_4;

  

  cVar1 = FUN_0043c4a0(param_1,param_2,param_3,&local_4);

  if (cVar1 != '\0') {

    FUN_004395d0(local_4);

    return 1;

  }

  return 0;

}





// --- FUN_00439f70 at 0x00439F70 (size: 106) ---


undefined1 FUN_00439f70(char *param_1)



{

  int *piVar1;

  LONG LVar2;

  undefined1 uVar3;

  char *local_4;

  

  local_4 = (char *)0x0;

  piVar1 = _errno();

  *piVar1 = 0;

  strtoul(param_1,&local_4,0);

  if (*local_4 == '\0') {

    piVar1 = _errno();

    if (*piVar1 != 0x22) {

      uVar3 = 1;

      goto LAB_00439fb6;

    }

  }

  uVar3 = 0;

LAB_00439fb6:

  LVar2 = InterlockedDecrement((LONG *)(param_1 + -0x10));

  if ((LVar2 == 0) && (param_1 + -0x14 != (char *)0x0)) {

    (*(code *)**(undefined4 **)(param_1 + -0x14))(1);

  }

  return uVar3;

}





// --- FUN_00439fe0 at 0x00439FE0 (size: 59) ---


void FUN_00439fe0(uint *param_1,uint *param_2)



{

  uint uVar1;

  uint uVar2;

  uint *puVar3;

  

  for (; param_1 != param_2; param_1 = param_1 + 1) {

    uVar1 = *param_1;

    uVar2 = param_1[-1];

    puVar3 = param_1;

    while (uVar1 < uVar2) {

      *puVar3 = uVar2;

      uVar2 = puVar3[-2];

      puVar3 = puVar3 + -1;

    }

    *puVar3 = uVar1;

  }

  return;

}





// --- FUN_0043a020 at 0x0043A020 (size: 69) ---


void FUN_0043a020(undefined4 *param_1,undefined4 *param_2,undefined4 param_3,undefined4 param_4)



{

  for (; param_1 != param_2; param_1 = param_1 + 4) {

    FUN_004396c0(param_1,*param_1,param_1[1],param_1[2],param_1[3],param_4);

  }

  return;

}





// --- FUN_0043a070 at 0x0043A070 (size: 95) ---


void FUN_0043a070(int param_1,int param_2,int param_3,undefined4 param_4,undefined4 param_5)



{

  int iVar1;

  int iVar2;

  int iVar3;

  

  iVar3 = param_2;

  while( true ) {

    iVar1 = iVar3 * 2;

    iVar2 = iVar1 + 2;

    if (param_3 <= iVar2) break;

    if (*(uint *)(param_1 + iVar2 * 4) < *(uint *)(param_1 + -4 + iVar2 * 4)) {

      iVar2 = iVar1 + 1;

    }

    *(undefined4 *)(param_1 + iVar3 * 4) = *(undefined4 *)(param_1 + iVar2 * 4);

    iVar3 = iVar2;

  }

  if (iVar2 == param_3) {

    *(undefined4 *)(param_1 + iVar3 * 4) = *(undefined4 *)(param_1 + -4 + iVar2 * 4);

    iVar3 = iVar1 + 1;

  }

  FUN_00439710(param_1,iVar3,param_2,param_4,param_5);

  return;

}





// --- FUN_0043a0d0 at 0x0043A0D0 (size: 187) ---


void FUN_0043a0d0(int param_1,int param_2,int param_3,undefined4 param_4,undefined4 param_5,

                 undefined4 param_6,undefined4 param_7,undefined4 param_8)



{

  int iVar1;

  int iVar2;

  undefined4 *puVar3;

  int iVar4;

  undefined4 *puVar5;

  

  iVar4 = param_2;

  while( true ) {

    iVar1 = iVar4 * 2;

    iVar2 = iVar1 + 2;

    if (param_3 <= iVar2) break;

    if (*(uint *)(iVar2 * 0x10 + 8 + param_1) < *(uint *)(iVar2 * 0x10 + param_1 + -8)) {

      iVar2 = iVar1 + 1;

    }

    puVar5 = (undefined4 *)(iVar2 * 0x10 + param_1);

    puVar3 = (undefined4 *)(iVar4 * 0x10 + param_1);

    *puVar3 = *puVar5;

    puVar3[1] = puVar5[1];

    puVar3[2] = puVar5[2];

    puVar3[3] = puVar5[3];

    iVar4 = iVar2;

  }

  if (iVar2 == param_3) {

    puVar3 = (undefined4 *)(iVar2 * 0x10 + -0x10 + param_1);

    puVar5 = (undefined4 *)(iVar4 * 0x10 + param_1);

    *puVar5 = *puVar3;

    puVar5[1] = puVar3[1];

    puVar5[2] = puVar3[2];

    puVar5[3] = puVar3[3];

    iVar4 = iVar1 + 1;

  }

  FUN_00439760(param_1,iVar4,param_2,param_4,param_5,param_6,param_7,param_8);

  return;

}





// --- FUN_0043a190 at 0x0043A190 (size: 70) ---


void FUN_0043a190(uint *param_1,uint *param_2,uint param_3)



{

  uint uVar1;

  uint *puVar2;

  

  while( true ) {

    uVar1 = *param_1;

    while (uVar1 < param_3) {

      puVar2 = param_1 + 1;

      param_1 = param_1 + 1;

      uVar1 = *puVar2;

    }

    uVar1 = param_2[-1];

    puVar2 = param_2;

    while (param_2 = puVar2 + -1, param_3 < uVar1) {

      uVar1 = puVar2[-2];

      puVar2 = param_2;

    }

    if (param_2 <= param_1) break;

    uVar1 = *param_1;

    *param_1 = *param_2;

    *param_2 = uVar1;

    param_1 = param_1 + 1;

  }

  return;

}





// --- FUN_0043a1e0 at 0x0043A1E0 (size: 143) ---


void FUN_0043a1e0(undefined4 *param_1,undefined4 *param_2,undefined4 param_3,undefined4 param_4,

                 uint param_5)



{

  uint *puVar1;

  uint uVar2;

  undefined4 uVar3;

  undefined4 uVar4;

  undefined4 uVar5;

  undefined4 uVar6;

  

  while( true ) {

    uVar2 = param_1[2];

    while (uVar2 < param_5) {

      puVar1 = param_1 + 6;

      param_1 = param_1 + 4;

      uVar2 = *puVar1;

    }

    uVar2 = param_2[-2];

    while (param_2 = param_2 + -4, param_5 < uVar2) {

      uVar2 = param_2[-2];

    }

    if (param_2 <= param_1) break;

    uVar3 = *param_1;

    uVar4 = param_1[1];

    uVar5 = param_1[2];

    uVar6 = param_1[3];

    *param_1 = *param_2;

    param_1[1] = param_2[1];

    param_1[2] = param_2[2];

    param_1[3] = param_2[3];

    *param_2 = uVar3;

    param_2[1] = uVar4;

    param_2[2] = uVar5;

    param_2[3] = uVar6;

    param_1 = param_1 + 4;

  }

  return;

}





// --- FUN_0043a270 at 0x0043A270 (size: 83) ---


void FUN_0043a270(int param_1,int param_2,undefined4 param_3)



{

  int iVar1;

  int iVar2;

  int iVar3;

  

  iVar2 = param_2 - param_1 >> 2;

  if (1 < iVar2) {

    iVar3 = (iVar2 + -2) / 2;

    FUN_0043a070(param_1,iVar3,iVar2,*(undefined4 *)(param_1 + iVar3 * 4),param_3);

    while (iVar3 != 0) {

      iVar1 = iVar3 * 4;

      iVar3 = iVar3 + -1;

      FUN_0043a070(param_1,iVar3,iVar2,*(undefined4 *)(param_1 + -4 + iVar1),param_3);

    }

  }

  return;

}





// --- FUN_0043a2d0 at 0x0043A2D0 (size: 154) ---


void FUN_0043a2d0(int param_1,int param_2,undefined4 param_3)



{

  undefined4 *puVar1;

  int iVar2;

  int iVar3;

  

  iVar3 = param_2 - param_1 >> 4;

  if (1 < iVar3) {

    iVar2 = (iVar3 + -2) / 2;

    puVar1 = (undefined4 *)(iVar2 * 0x10 + param_1);

    FUN_0043a0d0(param_1,iVar2,iVar3,*puVar1,puVar1[1],puVar1[2],puVar1[3],param_3);

    while (iVar2 != 0) {

      iVar2 = iVar2 + -1;

      FUN_0043a0d0(param_1,iVar2,iVar3,puVar1[-4],puVar1[-3],puVar1[-2],puVar1[-1],param_3);

      puVar1 = puVar1 + -4;

    }

  }

  return;

}





// --- FUN_0043a370 at 0x0043A370 (size: 416) ---


void FUN_0043a370(void)



{

  int *piVar1;

  LONG LVar2;

  undefined4 *puVar3;

  int local_4;

  

  if (DAT_00838196 != '\0') {

    FUN_00401340(&DAT_00799d90);

    FUN_00436830(&local_4);

    puVar3 = (undefined4 *)(local_4 + -0x14);

    LVar2 = InterlockedDecrement((LONG *)(local_4 + -0x10));

    if ((LVar2 == 0) && (puVar3 != (undefined4 *)0x0)) {

      (**(code **)*puVar3)(1);

    }

    FUN_00401340(&DAT_00799d88);

    FUN_00436830(&local_4);

    puVar3 = (undefined4 *)(local_4 + -0x14);

    LVar2 = InterlockedDecrement((LONG *)(local_4 + -0x10));

    if ((LVar2 == 0) && (puVar3 != (undefined4 *)0x0)) {

      (**(code **)*puVar3)(1);

    }

    FUN_00401340("UpdatePresentation");

    FUN_00436830(&local_4);

    puVar3 = (undefined4 *)(local_4 + -0x14);

    LVar2 = InterlockedDecrement((LONG *)(local_4 + -0x10));

    if ((LVar2 == 0) && (puVar3 != (undefined4 *)0x0)) {

      (**(code **)*puVar3)(1);

    }

    FUN_00401340("ForceDisplayResolution");

    FUN_00436830(&local_4);

    LVar2 = InterlockedDecrement((LONG *)(local_4 + -0x10));

    if ((LVar2 == 0) && ((undefined4 *)(local_4 + -0x14) != (undefined4 *)0x0)) {

      (*(code *)**(undefined4 **)(local_4 + -0x14))(1);

    }

    FUN_00439320();

    piVar1 = DAT_00837ff4;

    DAT_00838195 = 0;

    (**(code **)(*DAT_00837ff4 + 0xc))();

    (**(code **)*piVar1)(1);

    DAT_00837ff4 = (int *)0x0;

    FUN_00439400();

    if (DAT_008381a4 != (HWND)0x0) {

      DestroyWindow(DAT_008381a4);

      if (DAT_008381a8 == '\0') {

        PostQuitMessage(0);

      }

      DAT_008381a4 = (HWND)0x0;

    }

    thunk_FUN_00436cf0(&DAT_008381c8);

    thunk_FUN_00436cf0(&DAT_008381cc);

    thunk_FUN_00436cf0(&DAT_008381d0);

    thunk_FUN_00436cf0(&DAT_008381d4);

    if (DAT_008381ac != (undefined4 *)0x0) {

      (**(code **)*DAT_008381ac)(1);

    }

    DAT_008381ac = (undefined4 *)0x0;

    SetThreadExecutionState(0x80000000);

    DAT_00838196 = '\0';

  }

  return;

}





// --- FUN_0043a510 at 0x0043A510 (size: 619) ---


char FUN_0043a510(void)



{

  char cVar1;

  int iVar2;

  int iVar3;

  int iVar4;

  int iVar5;

  int iVar6;

  BOOL BVar7;

  int iVar8;

  undefined4 extraout_ECX;

  undefined4 extraout_ECX_00;

  undefined4 extraout_ECX_01;

  int iVar9;

  int Y;

  LONG *pLVar10;

  int *piVar11;

  LONG *pLVar12;

  int *piVar13;

  undefined4 uVar14;

  undefined4 uVar15;

  undefined4 uVar16;

  undefined1 auStack_5c [8];

  int iStack_54;

  int local_50;

  int local_4c;

  int iStack_48;

  tagRECT tStack_44;

  int aiStack_28 [3];

  LONG local_1c [3];

  char local_10;

  

  if (DAT_0086734c == 0) {

    return '\0';

  }

  pLVar10 = &tStack_44.bottom;

  piVar13 = DAT_00870340;

  for (iVar8 = 7; piVar13 = piVar13 + 1, iVar8 != 0; iVar8 = iVar8 + -1) {

    *pLVar10 = *piVar13;

    pLVar10 = pLVar10 + 1;

  }

  pLVar10 = &tStack_44.bottom;

  pLVar12 = local_1c;

  for (iVar8 = 7; iVar8 != 0; iVar8 = iVar8 + -1) {

    *pLVar12 = *pLVar10;

    pLVar10 = pLVar10 + 1;

    pLVar12 = pLVar12 + 1;

  }

  local_50 = DAT_00870340[8];

  local_4c = DAT_00870340[9];

  cVar1 = FUN_00439370(local_1c);

  if (cVar1 == '\0') {

    return '\0';

  }

  (*(code *)PTR_FUN_008373b0)

            (DAT_008381a4,0xfffffff0,(-(uint)(local_10 != '\0') & 0x7f360000) + 0x12ca0000);

  SetWindowPos(DAT_008381a4,(HWND)0xfffffffe,0,0,0,0,0x27);

  cVar1 = FUN_0054e2c0(aiStack_28,auStack_5c);

  piVar13 = aiStack_28;

  piVar11 = DAT_00870340;

  for (iVar8 = 7; piVar11 = piVar11 + 1, iVar8 != 0; iVar8 = iVar8 + -1) {

    *piVar13 = *piVar11;

    piVar13 = piVar13 + 1;

  }

  iVar9 = 0;

  Y = 0;

  iVar8 = aiStack_28[1];

  iVar3 = aiStack_28[2];

  if ((char)local_1c[0] != '\0') goto LAB_0043a6eb;

  iVar2 = GetSystemMetrics(7);

  iVar3 = GetSystemMetrics(8);

  iVar4 = GetSystemMetrics(4);

  iVar5 = GetSystemMetrics(0);

  iVar6 = GetSystemMetrics(1);

  iVar8 = aiStack_28[1] + iVar2 * 2;

  iVar3 = aiStack_28[2] + iVar4 + iVar3 * 2;

  if ((char)tStack_44.bottom == '\0') {

    BVar7 = GetWindowRect(DAT_008381a4,&tStack_44);

    if (BVar7 != 0) {

      iVar9 = (tStack_44.right - iVar8) + tStack_44.left;

      iVar9 = iVar9 - (iVar9 >> 0x1f);

      iVar6 = (tStack_44.bottom - iVar3) + tStack_44.top;

      goto LAB_0043a67d;

    }

  }

  else {

    iVar9 = (iVar5 - iVar8) - (iVar5 - iVar8 >> 0x1f);

    iVar6 = iVar6 - iVar3;

LAB_0043a67d:

    iVar9 = iVar9 >> 1;

    Y = iVar6 / 2;

  }

  BVar7 = SystemParametersInfoA(0x30,0x10,&iStack_54,0);

  if (BVar7 == 0) goto LAB_0043a6eb;

  if (local_4c - iStack_54 < iVar8) {

    iStack_54 = iStack_54 - iVar2;

LAB_0043a6ce:

    iVar9 = iStack_54;

  }

  else {

    if (local_4c < iVar8 + iVar9) {

      iVar9 = (local_4c - iStack_54) - iVar8;

    }

    if (iVar9 < iStack_54) goto LAB_0043a6ce;

  }

  if (iVar3 <= iStack_48 - local_50) {

    if (iStack_48 < iVar3 + Y) {

      Y = (iStack_48 - local_50) - iVar3;

    }

    if (local_50 <= Y) goto LAB_0043a6eb;

  }

  Y = local_50;

LAB_0043a6eb:

  SetWindowPos(DAT_008381a4,(HWND)(((char)local_1c[0] != '\0') - 2),iVar9,Y,iVar8,iVar3,0x100);

  if (cVar1 != '\0') {

    FUN_0045b4c0(0xe,0);

    return cVar1;

  }

  uVar16 = extraout_ECX;

  FUN_00402730(&DAT_00795320);

  uVar15 = extraout_ECX_00;

  FUN_00402730(&DAT_00795320);

  uVar14 = extraout_ECX_01;

  FUN_00402730(&DAT_00795320);

  FUN_0043d090(0x80,uVar14,uVar15,uVar16);

                    /* WARNING: Subroutine does not return */

  exit(1);

}





// --- FUN_0043a780 at 0x0043A780 (size: 351) ---


char FUN_0043a780(int *param_1)



{

  undefined *puVar1;

  char cVar2;

  int *piVar3;

  LONG LVar4;

  int iVar5;

  undefined4 *puVar6;

  undefined *local_c;

  undefined *local_8;

  int local_4;

  

  if (DAT_0086734c == 0) {

    return '\0';

  }

  piVar3 = (int *)FUN_00439460();

  if (piVar3 == (int *)0x0) {

    return '\0';

  }

  local_4 = DAT_00838188;

  InterlockedIncrement((LONG *)(DAT_00838188 + -0x10));

  local_8 = PTR_DAT_00818344;

  InterlockedIncrement((LONG *)(PTR_DAT_00818344 + -0x10));

  thunk_FUN_0040c780(&local_8,&local_4);

  local_c = PTR_DAT_00818344;

  InterlockedIncrement((LONG *)(PTR_DAT_00818344 + -0x10));

  iVar5 = 0;

  do {

    FUN_00402710(&local_c,"%sScreenShot%05d.jpg",local_8,iVar5);

    cVar2 = FUN_0040b320(&local_c,0);

    if (cVar2 == '\0') break;

    iVar5 = iVar5 + 1;

  } while (iVar5 < 100000);

  cVar2 = FUN_00443dc0(&local_c);

  if ((cVar2 != '\0') && (puVar1 = (undefined *)*param_1, puVar1 != local_c)) {

    LVar4 = InterlockedDecrement((LONG *)(puVar1 + -0x10));

    if ((LVar4 == 0) && ((undefined4 *)(puVar1 + -0x14) != (undefined4 *)0x0)) {

      (*(code *)**(undefined4 **)(puVar1 + -0x14))(1);

    }

    *param_1 = (int)local_c;

    InterlockedIncrement((LONG *)(local_c + -0x10));

  }

  (**(code **)(*piVar3 + 0x14))();

  puVar6 = (undefined4 *)(local_c + -0x14);

  LVar4 = InterlockedDecrement((LONG *)(local_c + -0x10));

  if ((LVar4 == 0) && (puVar6 != (undefined4 *)0x0)) {

    (**(code **)*puVar6)(1);

  }

  puVar6 = (undefined4 *)(local_8 + -0x14);

  LVar4 = InterlockedDecrement((LONG *)(local_8 + -0x10));

  if ((LVar4 == 0) && (puVar6 != (undefined4 *)0x0)) {

    (**(code **)*puVar6)(1);

  }

  puVar6 = (undefined4 *)(local_4 + -0x14);

  LVar4 = InterlockedDecrement((LONG *)(local_4 + -0x10));

  if ((LVar4 == 0) && (puVar6 != (undefined4 *)0x0)) {

    (**(code **)*puVar6)(1);

  }

  return cVar2;

}





// --- FUN_0043a8f0 at 0x0043A8F0 (size: 52) ---


void FUN_0043a8f0(void)



{

  undefined4 extraout_ECX;

  undefined4 extraout_ECX_00;

  undefined4 uVar1;

  undefined4 uVar2;

  undefined4 extraout_var;

  undefined4 uVar3;

  undefined4 uVar4;

  

  uVar4 = 1;

  FUN_00402730(&DAT_00795320);

  uVar2 = extraout_ECX;

  uVar3 = extraout_var;

  FUN_00402730(&DAT_00795320);

  uVar1 = extraout_ECX_00;

  FUN_00402730(&DAT_00795320);

  FUN_0043d090(0x7b,uVar1,uVar2,uVar3,uVar4);

  return;

}





// --- FUN_0043a930 at 0x0043A930 (size: 88) ---


undefined4 __thiscall FUN_0043a930(int *param_1,undefined4 *param_2)



{

  undefined4 uVar1;

  undefined4 *puVar2;

  

  if ((param_1[1] & 0x7fffffffU) <= (uint)param_1[2]) {

    uVar1 = FUN_00453850((param_1[1] & 0x7fffffffU) + 1);

    uVar1 = FUN_0059df80(uVar1);

    if ((char)uVar1 == '\0') {

      return uVar1;

    }

  }

  puVar2 = (undefined4 *)(param_1[2] * 0x10 + *param_1);

  *puVar2 = *param_2;

  puVar2[1] = param_2[1];

  puVar2[2] = param_2[2];

  puVar2[3] = param_2[3];

  param_1[2] = param_1[2] + 1;

  return CONCAT31((int3)((uint)puVar2 >> 8),1);

}





// --- FUN_0043a990 at 0x0043A990 (size: 209) ---


void FUN_0043a990(char param_1,int param_2,int param_3)



{

  char cVar1;

  int iVar2;

  undefined1 local_1c [4];

  int local_18;

  int local_14;

  

  cVar1 = DAT_008381a0;

  DAT_00818b04 = param_2;

  DAT_00818b08 = param_3;

  DAT_008381a0 = param_1;

  if (DAT_0086734c != 0) {

    if (DAT_00838196 != '\0') {

      if (param_1 == '\0') {

        if (cVar1 == '\0') {

          return;

        }

        local_18 = 800;

        local_14 = 600;

        cVar1 = FUN_00439370(local_1c);

        if (((cVar1 != '\0') && (iVar2 = FUN_0054fd20(), iVar2 == local_18)) &&

           (iVar2 = FUN_0054fd30(), iVar2 == local_14)) {

          return;

        }

      }

      else {

        iVar2 = FUN_0054fd20();

        if ((iVar2 == DAT_00818b04) && (iVar2 = FUN_0054fd30(), iVar2 == DAT_00818b08)) {

          return;

        }

      }

    }

    if ((DAT_0086734c != 0) && (DAT_00838196 != '\0')) {

      FUN_0043a510();

      return;

    }

  }

  return;

}





// --- FUN_0043aa70 at 0x0043AA70 (size: 146) ---


undefined4 FUN_0043aa70(int *param_1)



{

  char cVar1;

  undefined4 uVar2;

  int iVar3;

  

  if (param_1[2] == 0) {

    FUN_0043a990(0,DAT_00818b04,DAT_00818b08);

    return 1;

  }

  if (1 < (uint)param_1[2]) {

    iVar3 = *(int *)*param_1;

    InterlockedIncrement((LONG *)(iVar3 + -0x10));

    cVar1 = FUN_00439f70(iVar3);

    if (cVar1 != '\0') {

      iVar3 = *(int *)(*param_1 + 4);

      InterlockedIncrement((LONG *)(iVar3 + -0x10));

      cVar1 = FUN_00439f70(iVar3);

      if (cVar1 != '\0') {

        uVar2 = FUN_00404d70();

        uVar2 = FUN_00404d70(uVar2);

        FUN_0043a990(1,uVar2);

        return 1;

      }

    }

  }

  return 0;

}





// --- FUN_0043ab10 at 0x0043AB10 (size: 52) ---


void FUN_0043ab10(char param_1)



{

  DAT_00818b02 = param_1;

  if ((((DAT_0086734c != 0) && (DAT_00838196 != '\0')) && (*(char *)(DAT_00870340 + 0x10) != '\0'))

     && (param_1 == '\0')) {

    FUN_0043a510();

    return;

  }

  return;

}





// --- FUN_0043ab50 at 0x0043AB50 (size: 250) ---


undefined4 FUN_0043ab50(void)



{

  int iVar1;

  int iVar2;

  HGLOBAL hMem;

  SIZE_T SVar3;

  LPVOID pvVar4;

  undefined2 *puVar5;

  undefined2 *puVar6;

  int *unaff_EBX;

  uint uVar7;

  bool bVar8;

  

  bVar8 = DAT_0083819c != 2;

  iVar1 = (-(uint)bVar8 & 0xfffffff4) + 0xd;

  iVar2 = (*(code *)PTR_FUN_008373a8)(iVar1);

  if (iVar2 == 0) {

    return 0;

  }

  OpenClipboard(DAT_008381a4);

  hMem = (HGLOBAL)(*(code *)PTR_FUN_008373a4)(iVar1);

  SVar3 = GlobalSize(hMem);

  if (bVar8) {

    pvVar4 = GlobalLock(hMem);

    if (pvVar4 != (LPVOID)0x0) {

      puVar5 = (undefined2 *)thunk_FUN_005df0f5(SVar3 * 2);

      if ((puVar5 != (undefined2 *)0x0) && (iVar1 = 0, 0 < (int)SVar3)) {

        do {

          puVar5[iVar1] = (short)*(char *)(iVar1 + (int)pvVar4);

          iVar1 = iVar1 + 1;

        } while (iVar1 < (int)SVar3);

      }

LAB_0043ac1d:

      GlobalUnlock(hMem);

      CloseClipboard();

      FUN_00407e40(puVar5);

      operator_delete__(puVar5);

      return CONCAT31((int3)((uint)*unaff_EBX >> 8),*(int *)(*unaff_EBX + -4) != 1);

    }

  }

  else {

    uVar7 = SVar3 >> 1;

    pvVar4 = GlobalLock(hMem);

    if (pvVar4 != (LPVOID)0x0) {

      puVar5 = (undefined2 *)thunk_FUN_005df0f5(uVar7 * 2);

      if ((puVar5 != (undefined2 *)0x0) && (uVar7 != 0)) {

        puVar6 = puVar5;

        do {

          *puVar6 = *(undefined2 *)(((int)pvVar4 - (int)puVar5) + (int)puVar6);

          puVar6 = puVar6 + 1;

          uVar7 = uVar7 - 1;

        } while (uVar7 != 0);

      }

      goto LAB_0043ac1d;

    }

  }

  return 0;

}





// --- FUN_0043ac60 at 0x0043AC60 (size: 297) ---


undefined4 FUN_0043ac60(undefined4 param_1,undefined4 param_2,char param_3)



{

  char cVar1;

  HDC hdc;

  int iVar2;

  undefined4 extraout_ECX;

  undefined4 extraout_ECX_00;

  undefined4 extraout_ECX_01;

  undefined4 uVar3;

  undefined4 uVar4;

  undefined4 uVar5;

  undefined4 uVar6;

  undefined4 local_24;

  undefined1 local_20;

  undefined1 uStack_1f;

  undefined1 uStack_1e;

  undefined4 local_1c;

  undefined4 local_18;

  undefined4 local_14;

  undefined1 local_10;

  undefined4 local_c;

  undefined4 local_8;

  undefined1 uStack_4;

  undefined1 uStack_3;

  undefined1 uStack_2;

  

  if (param_3 != '\0') {

    hdc = CreateICA("Display",(LPCSTR)0x0,(LPCSTR)0x0,(DEVMODEA *)0x0);

    iVar2 = GetDeviceCaps(hdc,0xc);

    DeleteDC(hdc);

    if (iVar2 == 0x10) {

      FUN_0043a8f0();

    }

    else if (iVar2 != 0x20) {

      uVar6 = 0;

      uVar5 = extraout_ECX;

      FUN_00402730(&DAT_00795320);

      uVar4 = extraout_ECX_00;

      FUN_00402730(&DAT_00795320);

      uVar3 = extraout_ECX_01;

      FUN_00402730(&DAT_00795320);

      FUN_0043d090(0x7d,uVar3,uVar4,uVar5,uVar6);

                    /* WARNING: Subroutine does not return */

      exit(1);

    }

  }

  local_18 = param_1;

  local_1c = 0;

  local_c = 0;

  local_8 = 0x20;

  uStack_4 = 0;

  uStack_3 = 0;

  uStack_2 = 0;

  local_24 = 0;

  local_20 = 1;

  uStack_1f = 0;

  uStack_1e = 1;

  local_14 = param_2;

  if ((DAT_00818b02 == '\0') || (local_10 = 1, param_3 != '\0')) {

    local_10 = 0;

  }

  cVar1 = FUN_00439370(&local_1c);

  if (cVar1 != '\0') {

    local_1c = DAT_008381a4;

    local_24 = DAT_008381a4;

    cVar1 = FUN_0054e1a0(&local_1c,&local_24);

    if ((cVar1 != '\0') && (cVar1 = FUN_004402d0(), cVar1 != '\0')) {

      FUN_0054e6a0();

      return 1;

    }

  }

  return 0;

}





// --- FUN_0043ad90 at 0x0043AD90 (size: 45) ---


undefined4 FUN_0043ad90(undefined4 param_1,undefined4 param_2,undefined4 param_3)



{

  char cVar1;

  

  DAT_00838195 = 0;

  cVar1 = FUN_0043ac60(param_1,param_2,param_3);

  if (cVar1 != '\0') {

    DAT_00838195 = 1;

    return 1;

  }

  return 0;

}





// --- FUN_0043adc0 at 0x0043ADC0 (size: 113) ---


void FUN_0043adc0(uint *param_1,uint *param_2)



{

  size_t _Size;

  uint uVar1;

  uint uVar2;

  uint *puVar3;

  uint *puVar4;

  

  if ((param_1 != param_2) && (puVar4 = param_1 + 1, puVar4 != param_2)) {

    do {

      uVar1 = *puVar4;

      if (uVar1 < *param_1) {

        _Size = (int)puVar4 - (int)param_1;

        if (0 < (int)_Size) {

          memmove((void *)((int)puVar4 + (4 - _Size)),param_1,_Size);

        }

        *param_1 = uVar1;

      }

      else {

        uVar2 = puVar4[-1];

        puVar3 = puVar4;

        while (uVar1 < uVar2) {

          *puVar3 = uVar2;

          uVar2 = puVar3[-2];

          puVar3 = puVar3 + -1;

        }

        *puVar3 = uVar1;

      }

      puVar4 = puVar4 + 1;

    } while (puVar4 != param_2);

  }

  return;

}





// --- FUN_0043ae40 at 0x0043AE40 (size: 117) ---


void FUN_0043ae40(undefined4 *param_1,int param_2,undefined4 param_3,undefined4 param_4,uint param_5

                 ,undefined4 param_6,undefined4 param_7)



{

  undefined4 *puVar1;

  uint uVar2;

  

  uVar2 = param_5;

  puVar1 = param_1;

  if (param_5 < (uint)param_1[2]) {

    FUN_004397e0(param_1,param_2,param_2 + 0x10,&param_1,0);

    *puVar1 = param_3;

    puVar1[1] = param_4;

    puVar1[2] = uVar2;

    puVar1[3] = param_6;

    return;

  }

  FUN_004396c0(param_2,param_3,param_4,param_5,param_6,param_7);

  return;

}





// --- FUN_0043aec0 at 0x0043AEC0 (size: 77) ---


void FUN_0043aec0(undefined4 *param_1,int param_2,undefined4 param_3)



{

  undefined4 uVar1;

  uint uVar2;

  

  uVar2 = param_2 - (int)param_1;

  while (4 < (int)(uVar2 & 0xfffffffc)) {

    uVar1 = *(undefined4 *)((int)param_1 + (uVar2 - 4));

    *(undefined4 *)((int)param_1 + (uVar2 - 4)) = *param_1;

    FUN_0043a070(param_1,0,(int)(uVar2 - 4) >> 2,uVar1,param_3);

    uVar2 = uVar2 - 4;

  }

  return;

}





// --- FUN_0043af10 at 0x0043AF10 (size: 147) ---


void FUN_0043af10(undefined4 *param_1,int param_2,undefined4 param_3)



{

  undefined4 *puVar1;

  undefined4 uVar2;

  undefined4 uVar3;

  undefined4 uVar4;

  undefined4 uVar5;

  uint uVar6;

  

  uVar6 = param_2 - (int)param_1;

  while (0x10 < (int)(uVar6 & 0xfffffff0)) {

    puVar1 = (undefined4 *)((int)param_1 + (uVar6 - 0x10));

    uVar2 = *puVar1;

    uVar3 = puVar1[1];

    uVar4 = puVar1[2];

    uVar5 = puVar1[3];

    *puVar1 = *param_1;

    puVar1[1] = param_1[1];

    puVar1[2] = param_1[2];

    puVar1[3] = param_1[3];

    uVar6 = uVar6 - 0x10;

    FUN_0043a0d0(param_1,0,(int)uVar6 >> 4,uVar2,uVar3,uVar4,uVar5,param_3);

  }

  return;

}





// --- FUN_0043afb0 at 0x0043AFB0 (size: 81) ---


void FUN_0043afb0(undefined4 *param_1,undefined4 *param_2,undefined4 param_3)



{

  undefined4 *puVar1;

  

  puVar1 = param_1;

  if (param_1 != param_2) {

    while (puVar1 = puVar1 + 4, puVar1 != param_2) {

      FUN_0043ae40(param_1,puVar1,*puVar1,puVar1[1],puVar1[2],puVar1[3],param_3);

    }

  }

  return;

}





// --- FUN_0043b010 at 0x0043B010 (size: 106) ---


void FUN_0043b010(uint *param_1,uint *param_2,uint *param_3,undefined4 param_4,undefined4 param_5)



{

  uint uVar1;

  uint *puVar2;

  

  FUN_0043a270(param_1,param_2,param_5,0,0);

  for (puVar2 = param_2; puVar2 < param_3; puVar2 = puVar2 + 1) {

    uVar1 = *puVar2;

    if (uVar1 < *param_1) {

      *puVar2 = *param_1;

      FUN_0043a070(param_1,0,(int)param_2 - (int)param_1 >> 2,uVar1,param_5);

    }

  }

  FUN_0043aec0(param_1,param_2,param_5);

  return;

}





// --- FUN_0043b080 at 0x0043B080 (size: 185) ---


void FUN_0043b080(undefined4 *param_1,undefined4 *param_2,undefined4 *param_3,undefined4 param_4,

                 undefined4 param_5)



{

  undefined4 uVar1;

  undefined4 uVar2;

  undefined4 uVar3;

  undefined4 uVar4;

  undefined4 *puVar5;

  

  FUN_0043a2d0(param_1,param_2,param_5,0,0);

  for (puVar5 = param_2; puVar5 < param_3; puVar5 = puVar5 + 4) {

    if ((uint)puVar5[2] < (uint)param_1[2]) {

      uVar1 = *puVar5;

      uVar2 = puVar5[1];

      uVar3 = puVar5[2];

      uVar4 = puVar5[3];

      *puVar5 = *param_1;

      puVar5[1] = param_1[1];

      puVar5[2] = param_1[2];

      puVar5[3] = param_1[3];

      FUN_0043a0d0(param_1,0,(int)param_2 - (int)param_1 >> 4,uVar1,uVar2,uVar3,uVar4,param_5);

    }

  }

  FUN_0043af10(param_1,param_2,param_5);

  return;

}





// --- FUN_0043b140 at 0x0043B140 (size: 169) ---


void FUN_0043b140(uint *param_1,int param_2,undefined4 param_3,int param_4,undefined4 param_5)



{

  uint uVar1;

  uint uVar2;

  uint uVar3;

  uint uVar4;

  uint *puVar5;

  int iVar6;

  uint *puVar7;

  

  if (0x40 < (int)(param_2 - (int)param_1 & 0xfffffffcU)) {

    while (param_4 != 0) {

      uVar1 = *param_1;

      iVar6 = (param_2 - (int)param_1 >> 2) - (param_2 - (int)param_1 >> 0x1f) >> 1;

      uVar2 = param_1[iVar6];

      param_4 = param_4 + -1;

      uVar3 = *(uint *)(param_2 + -4);

      uVar4 = uVar2;

      puVar5 = param_1 + iVar6;

      puVar7 = param_1;

      if (uVar1 < uVar2) {

        uVar4 = uVar1;

        puVar5 = param_1;

        puVar7 = param_1 + iVar6;

        uVar1 = uVar2;

      }

      if ((uVar3 <= uVar1) && (puVar7 = puVar5, uVar4 < uVar3)) {

        puVar7 = (uint *)(param_2 + -4);

      }

      iVar6 = FUN_0043a190(param_1,param_2,*puVar7,param_5);

      FUN_0043b140(iVar6,param_2,0,param_4,param_5);

      param_2 = iVar6;

      if ((int)(iVar6 - (int)param_1 & 0xfffffffcU) < 0x41) {

        return;

      }

    }

    FUN_0043b010(param_1,param_2,param_2,0,param_5);

  }

  return;

}





// --- FUN_0043b1f0 at 0x0043B1F0 (size: 211) ---


void FUN_0043b1f0(undefined4 *param_1,int param_2,undefined4 param_3,int param_4,undefined4 param_5)



{

  uint uVar1;

  uint uVar2;

  uint uVar3;

  undefined4 *puVar4;

  int iVar5;

  undefined4 *puVar6;

  

  if (0x100 < (int)(param_2 - (int)param_1 & 0xfffffff0U)) {

    while (param_4 != 0) {

      uVar1 = param_1[2];

      iVar5 = (param_2 - (int)param_1 >> 4) - (param_2 - (int)param_1 >> 0x1f) >> 1;

      uVar2 = param_1[iVar5 * 4 + 2];

      param_4 = param_4 + -1;

      uVar3 = uVar2;

      puVar4 = param_1 + iVar5 * 4;

      puVar6 = param_1;

      if (uVar1 < uVar2) {

        uVar3 = uVar1;

        puVar4 = param_1;

        puVar6 = param_1 + iVar5 * 4;

        uVar1 = uVar2;

      }

      if ((*(uint *)(param_2 + -8) <= uVar1) && (puVar6 = puVar4, uVar3 < *(uint *)(param_2 + -8)))

      {

        puVar6 = (undefined4 *)(param_2 + -0x10);

      }

      iVar5 = FUN_0043a1e0(param_1,param_2,*puVar6,puVar6[1],puVar6[2],puVar6[3],param_5);

      FUN_0043b1f0(iVar5,param_2,0,param_4,param_5);

      param_2 = iVar5;

      if ((int)(iVar5 - (int)param_1 & 0xfffffff0U) < 0x101) {

        return;

      }

    }

    FUN_0043b080(param_1,param_2,param_2,0,param_5);

  }

  return;

}





// --- FUN_0043b2d0 at 0x0043B2D0 (size: 1929) ---


undefined4 FUN_0043b2d0(void)



{

  void *pvVar1;

  void *pvVar2;

  char cVar3;

  char *pcVar4;

  int iVar5;

  undefined4 *puVar6;

  LONG LVar7;

  int iVar8;

  char *pcVar9;

  char *pcVar10;

  int *piVar11;

  int *piVar12;

  uint uVar13;

  int *piVar14;

  char *local_7c;

  undefined4 local_78;

  int local_74 [2];

  int *local_6c;

  undefined4 *local_68;

  void *local_60;

  uint local_5c;

  int local_58;

  uint local_54;

  int *local_50;

  uint local_4c;

  char *local_48;

  void *local_44;

  uint local_40;

  uint local_3c;

  byte local_2c;

  

  iVar5 = DAT_0086734c;

  if (DAT_0086734c == 0) {

    return 0;

  }

  piVar11 = (int *)0x0;

  pcVar10 = (char *)0x0;

  piVar14 = (int *)(DAT_0086734c + 0xc);

  local_50 = (int *)0x0;

  local_4c = 0;

  local_48 = (char *)0x0;

  local_44 = (void *)0x0;

  local_40 = 0;

  local_3c = 0;

  pcVar4 = *(char **)(DAT_0086734c + 0x14);

  local_7c = (char *)0x0;

  if (pcVar4 != (char *)0xffffffff) {

    local_6c = (int *)0x0;

    do {

      piVar12 = local_6c;

      if (local_7c < pcVar4) {

        if ((799 < *(uint *)((int)local_6c + *piVar14)) &&

           (599 < *(uint *)((int)local_6c + *piVar14 + 4))) {

          FUN_00535a80();

          FUN_0043d290(*(undefined4 *)((int)piVar12 + *piVar14 + 8));

          pcVar10 = local_48;

          piVar11 = local_50;

          if (0x1f < local_2c) {

            iVar8 = *piVar14;

            local_60 = *(void **)((int)piVar12 + iVar8);

            local_5c = *(uint *)((int)piVar12 + iVar8 + 4);

            local_74[0] = *(int *)((int)piVar12 + iVar8 + 0xc);

            goto LAB_0043b399;

          }

        }

      }

      else {

        local_60 = (void *)0x400;

        local_5c = 0x300;

        local_74[0] = 0;

LAB_0043b399:

        local_58 = local_5c * (int)local_60;

        local_54 = (int)local_60 << 0x10 | local_5c;

        pcVar4 = (char *)0x0;

        if (pcVar10 != (char *)0x0) {

          do {

            if (((void *)*piVar11 == local_60) && (piVar11[1] == local_5c)) {

              if (pcVar4 != (char *)0xffffffff) goto LAB_0043b3e6;

              break;

            }

            pcVar4 = pcVar4 + 1;

            piVar11 = piVar11 + 4;

          } while (pcVar4 < pcVar10);

        }

        FUN_0043a930(&local_60);

LAB_0043b3e6:

        FUN_00455770(local_74);

        pcVar10 = local_48;

        piVar11 = local_50;

        piVar12 = local_6c;

      }

      pcVar4 = *(char **)(iVar5 + 0x14);

      local_7c = local_7c + 1;

      local_6c = piVar12 + 4;

    } while (local_7c < pcVar4 + 1);

  }

  piVar14 = piVar11 + (int)pcVar10 * 4;

  if (piVar11 != piVar14) {

    iVar5 = (int)piVar14 - (int)piVar11 >> 4;

    iVar8 = 0;

    if (iVar5 != 1) {

      iVar8 = 0;

      do {

        iVar5 = iVar5 >> 1;

        iVar8 = iVar8 + 1;

      } while (iVar5 != 1);

    }

    FUN_0043b1f0(piVar11,piVar14,0,iVar8 * 2,local_6c);

    piVar12 = local_6c;

    if ((int)((int)piVar14 - (int)piVar11 & 0xfffffff0U) < 0x101) {

      FUN_0043afb0(piVar11,piVar14,local_6c);

    }

    else {

      FUN_0043afb0(piVar11,piVar11 + 0x40,local_6c);

      FUN_0043a020(piVar11 + 0x40,piVar14,0,piVar12);

    }

  }

  pvVar2 = local_44;

  pvVar1 = (void *)((int)local_44 + local_3c * 4);

  if (local_44 != pvVar1) {

    uVar13 = (int)pvVar1 - (int)local_44;

    iVar8 = 0;

    for (iVar5 = (int)uVar13 >> 2; iVar5 != 1; iVar5 = iVar5 >> 1) {

      iVar8 = iVar8 + 1;

    }

    FUN_0043b140(local_44,pvVar1,0,iVar8 * 2,local_6c);

    piVar11 = local_6c;

    if ((int)(uVar13 & 0xfffffffc) < 0x41) {

      FUN_0043adc0(pvVar2,pvVar1,local_6c);

    }

    else {

      FUN_0043adc0(pvVar2,(int)pvVar2 + 0x40,local_6c);

      FUN_00439fe0((int)pvVar2 + 0x40,pvVar1,0,piVar11);

    }

  }

  local_74[0] = 0;

  local_74[1] = 0;

  FUN_00435390(local_48);

  puVar6 = (undefined4 *)thunk_FUN_005df0f5((int)local_48 * 4);

  local_6c = (int *)0xffffffff;

  local_7c = (char *)0x0;

  local_68 = puVar6;

  if (local_48 != (char *)0x0) {

    iVar8 = 0;

    iVar5 = local_74[0] - (int)puVar6;

    do {

      piVar11 = (int *)(iVar8 + (int)local_50);

      FUN_00402710(iVar5 + (int)puVar6,"%ix%i",*(undefined4 *)(iVar8 + (int)local_50),

                   *(undefined4 *)(iVar8 + 4 + (int)local_50));

      *puVar6 = *(undefined4 *)(iVar8 + 0xc + (int)local_50);

      if ((*piVar11 == 0x400) && (piVar11[1] == 0x300)) {

        local_6c = (int *)piVar11[3];

      }

      local_7c = local_7c + 1;

      iVar8 = iVar8 + 0x10;

      puVar6 = puVar6 + 1;

    } while (local_7c < local_48);

  }

  uVar13 = 0;

  local_7c = (char *)0x0;

  local_78 = 0;

  FUN_00435390(local_3c);

  local_60 = (void *)thunk_FUN_005df0f5(local_3c * 4);

  pcVar4 = local_7c;

  if (local_3c != 0) {

    iVar5 = (int)local_60 - (int)local_7c;

    do {

      iVar8 = *(int *)((int)local_44 + uVar13 * 4);

      if (iVar8 == 0) {

        FUN_00405000(&DAT_00794fb0);

      }

      else {

        FUN_00402710(pcVar4 + uVar13 * 4,&DAT_00799e78,iVar8);

      }

      *(undefined4 *)(pcVar4 + uVar13 * 4 + iVar5) = *(undefined4 *)((int)local_44 + uVar13 * 4);

      uVar13 = uVar13 + 1;

    } while (uVar13 < local_3c);

  }

  DAT_00818b68 = 1;

  DAT_00818b64 = local_6c;

  DAT_00818b6c = 0;

  pcVar10 = "Selects display resolution";

  do {

    pcVar9 = pcVar10;

    pcVar10 = pcVar9 + 1;

  } while (*pcVar9 != '\0');

  FUN_00401280(pcVar9 + -0x799e5c);

  pcVar9 = "Selects display resolution";

  pcVar10 = local_7c;

  do {

    cVar3 = *pcVar9;

    pcVar9 = pcVar9 + 1;

    *pcVar10 = cVar3;

    pcVar10 = pcVar10 + 1;

  } while (cVar3 != '\0');

  FUN_004369a0(&DAT_00818b64,4,&DAT_008381c8,&local_7c,0,local_48,local_74[0],local_68);

  if (DAT_008380c8 == 0) {

    iVar5 = FUN_005df0f5(0x8100);

    if (iVar5 == 0) {

      DAT_008380c8 = 0;

    }

    else {

      DAT_008380c8 = FUN_00433d20();

    }

  }

  cVar3 = FUN_00433710(&DAT_008381c8,&local_6c);

  if ((cVar3 != '\0') && (iVar5 = (**(code **)(*local_6c + 0x44))(), iVar5 != 0)) {

    *(undefined1 *)(iVar5 + 0x28) = 1;

  }

  pcVar10 = local_7c + -0x14;

  LVar7 = InterlockedDecrement((LONG *)(local_7c + -0x10));

  if ((LVar7 == 0) && (pcVar10 != (char *)0x0)) {

    (*(code *)**(undefined4 **)pcVar10)(1);

  }

  pcVar10 = "Enables full screen mode";

  do {

    pcVar9 = pcVar10;

    pcVar10 = pcVar9 + 1;

  } while (*pcVar9 != '\0');

  FUN_00401280(pcVar9 + -0x799e40);

  pcVar9 = "Enables full screen mode";

  pcVar10 = local_7c;

  do {

    cVar3 = *pcVar9;

    pcVar9 = pcVar9 + 1;

    *pcVar10 = cVar3;

    pcVar10 = pcVar10 + 1;

  } while (cVar3 != '\0');

  FUN_004369a0(&DAT_00818b68,2,&DAT_008381cc,&local_7c,0,0,0,0);

  if (DAT_008380c8 == 0) {

    iVar5 = FUN_005df0f5(0x8100);

    if (iVar5 == 0) {

      DAT_008380c8 = 0;

    }

    else {

      DAT_008380c8 = FUN_00433d20();

    }

  }

  cVar3 = FUN_00433710(&DAT_008381cc,&local_6c);

  if ((cVar3 != '\0') && (iVar5 = (**(code **)(*local_6c + 0x44))(), iVar5 != 0)) {

    *(undefined1 *)(iVar5 + 0x28) = 1;

  }

  pcVar10 = local_7c + -0x14;

  LVar7 = InterlockedDecrement((LONG *)(local_7c + -0x10));

  if ((LVar7 == 0) && (pcVar10 != (char *)0x0)) {

    (*(code *)**(undefined4 **)pcVar10)(1);

  }

  pcVar10 = "Selects full screen refresh rate.";

  do {

    pcVar9 = pcVar10;

    pcVar10 = pcVar9 + 1;

  } while (*pcVar9 != '\0');

  FUN_00401280(pcVar9 + -0x799e1c);

  pvVar1 = local_60;

  pcVar9 = "Selects full screen refresh rate.";

  pcVar10 = local_7c;

  do {

    cVar3 = *pcVar9;

    pcVar9 = pcVar9 + 1;

    *pcVar10 = cVar3;

    pcVar10 = pcVar10 + 1;

  } while (cVar3 != '\0');

  FUN_004369a0(&DAT_00818b6c,4,&DAT_008381d0,&local_7c,0,local_3c,pcVar4,local_60);

  if (DAT_008380c8 == 0) {

    iVar5 = FUN_005df0f5(0x8100);

    if (iVar5 == 0) {

      DAT_008380c8 = 0;

    }

    else {

      DAT_008380c8 = FUN_00433d20();

    }

  }

  cVar3 = FUN_00433710(&DAT_008381d0,&local_6c);

  if ((cVar3 != '\0') && (iVar5 = (**(code **)(*local_6c + 0x44))(), iVar5 != 0)) {

    *(undefined1 *)(iVar5 + 0x28) = 1;

  }

  pcVar10 = local_7c + -0x14;

  LVar7 = InterlockedDecrement((LONG *)(local_7c + -0x10));

  if ((LVar7 == 0) && (pcVar10 != (char *)0x0)) {

    (*(code *)**(undefined4 **)pcVar10)(1);

  }

  pcVar10 = 

  "Syncs frames with the display\'s vertical refresh rate (eliminates tearing but reduces performance)"

  ;

  do {

    pcVar9 = pcVar10;

    pcVar10 = pcVar9 + 1;

  } while (*pcVar9 != '\0');

  FUN_00401280(pcVar9 + -0x799db8);

  pcVar9 = 

  "Syncs frames with the display\'s vertical refresh rate (eliminates tearing but reduces performance)"

  ;

  pcVar10 = local_7c;

  do {

    cVar3 = *pcVar9;

    pcVar9 = pcVar9 + 1;

    *pcVar10 = cVar3;

    pcVar10 = pcVar10 + 1;

  } while (cVar3 != '\0');

  FUN_004369a0(&DAT_00818b71,2,&DAT_008381d4,&local_7c,0,0,0,0);

  if (DAT_008380c8 == 0) {

    iVar5 = FUN_005df0f5(0x8100);

    if (iVar5 == 0) {

      DAT_008380c8 = 0;

    }

    else {

      DAT_008380c8 = FUN_00433d20();

    }

  }

  cVar3 = FUN_00433710(&DAT_008381d4,&local_6c);

  if ((cVar3 != '\0') && (iVar5 = (**(code **)(*local_6c + 0x44))(), iVar5 != 0)) {

    *(undefined1 *)(iVar5 + 0x28) = 1;

  }

  pcVar10 = local_7c + -0x14;

  LVar7 = InterlockedDecrement((LONG *)(local_7c + -0x10));

  if ((LVar7 == 0) && (pcVar10 != (char *)0x0)) {

    (*(code *)**(undefined4 **)pcVar10)(1);

  }

  operator_delete__(pvVar1);

  if (pcVar4 != (char *)0x0) {

    iVar5 = *(int *)(pcVar4 + -4);

    pcVar10 = pcVar4 + iVar5 * 4;

    if (-1 < iVar5 + -1) {

      do {

        piVar11 = (int *)(pcVar10 + -4);

        pcVar10 = pcVar10 + -4;

        puVar6 = (undefined4 *)(*piVar11 + -0x14);

        LVar7 = InterlockedDecrement((LONG *)(*piVar11 + -0x10));

        if ((LVar7 == 0) && (puVar6 != (undefined4 *)0x0)) {

          (**(code **)*puVar6)(1);

        }

        iVar5 = iVar5 + -1;

      } while (iVar5 != 0);

    }

    operator_delete__(pcVar4 + -4);

  }

  operator_delete__(local_68);

  if (local_74[0] != 0) {

    iVar8 = *(int *)(local_74[0] + -4);

    pvVar1 = (void *)(local_74[0] + -4);

    iVar5 = local_74[0] + iVar8 * 4;

    if (-1 < iVar8 + -1) {

      do {

        piVar11 = (int *)(iVar5 + -4);

        iVar5 = iVar5 + -4;

        puVar6 = (undefined4 *)(*piVar11 + -0x14);

        LVar7 = InterlockedDecrement((LONG *)(*piVar11 + -0x10));

        if ((LVar7 == 0) && (puVar6 != (undefined4 *)0x0)) {

          (**(code **)*puVar6)(1);

        }

        iVar8 = iVar8 + -1;

      } while (iVar8 != 0);

    }

    operator_delete__(pvVar1);

  }

  if ((local_40 & 0x80000000) == 0x80000000) {

    operator_delete__(local_44);

  }

  if ((local_4c & 0x80000000) == 0x80000000) {

    operator_delete__(local_50);

  }

  return 1;

}





// --- FUN_0043ba60 at 0x0043BA60 (size: 1417) ---


undefined4

FUN_0043ba60(undefined4 param_1,undefined4 *param_2,undefined4 param_3,char param_4,char param_5,

            uint *param_6)



{

  bool bVar1;

  char cVar2;

  ATOM AVar3;

  HMENU pHVar4;

  BOOL BVar5;

  HMODULE hInstance;

  DWORD DVar6;

  int iVar7;

  int iVar8;

  int iVar9;

  undefined4 extraout_ECX;

  undefined4 extraout_ECX_00;

  undefined4 extraout_ECX_01;

  undefined4 extraout_ECX_02;

  undefined4 extraout_ECX_03;

  undefined4 uVar10;

  undefined4 extraout_ECX_04;

  undefined4 extraout_ECX_05;

  undefined4 extraout_ECX_06;

  undefined4 extraout_ECX_07;

  int nWidth;

  int iVar11;

  undefined4 unaff_retaddr;

  undefined4 uVar12;

  undefined4 uVar13;

  undefined4 uVar14;

  undefined4 uVar15;

  uint local_f8;

  int local_f4;

  int local_f0;

  int local_ec;

  int local_e8;

  int local_e4;

  int local_e0;

  HMODULE local_dc;

  undefined4 local_d8;

  int local_d4;

  int local_d0;

  char local_cc;

  WNDCLASSA local_bc;

  _OSVERSIONINFOA local_94;

  

  if (DAT_00838196 != '\0') {

    return 0;

  }

  pHVar4 = GetMenu(DAT_008381a4);

  if (pHVar4 == (HMENU)0x0) {

    DAT_00818b01 = 0;

  }

  local_94.dwOSVersionInfoSize = 0x94;

  BVar5 = GetVersionExA(&local_94);

  uVar10 = extraout_ECX;

  if (BVar5 == 0) {

    uVar15 = 0;

    FUN_00402730(&DAT_00795320);

    uVar14 = extraout_ECX_06;

    FUN_00402730(&DAT_00795320);

    uVar13 = extraout_ECX_07;

    FUN_00402730(&DAT_00795320);

    uVar12 = 0x6b;

    goto LAB_0043bfcd;

  }

  iVar11 = 0;

  DAT_0083819c = local_94.dwPlatformId;

  if (local_94.dwPlatformId == 0) {

    uVar15 = 0;

    FUN_00402730(&DAT_00795320);

    uVar14 = extraout_ECX_00;

    FUN_00402730(&DAT_00795320);

    uVar13 = extraout_ECX_01;

    FUN_00402730(&DAT_00795320);

    uVar12 = 0x6a;

    goto LAB_0043bfcd;

  }

  hInstance = GetModuleHandleA((LPCSTR)(-(uint)(*(int *)(*param_6 - 4) != 1) & *param_6));

  if (*(int *)(*param_6 - 4) != 1) {

    DAT_008381a8 = 1;

  }

  if (DAT_0086734c != 0) {

    return 0;

  }

  local_f0 = 1;

  local_dc = hInstance;

  cVar2 = FUN_0054d0c0(&local_f0);

  if (cVar2 == '\0') {

    return 0;

  }

  cVar2 = FUN_0043b2d0();

  if (cVar2 == '\0') {

    return 0;

  }

  FUN_00439140();

  cVar2 = FUN_00439370(&local_d8);

  if (cVar2 == '\0') {

    return 0;

  }

  if ((DAT_00818b02 == '\0') || (bVar1 = false, local_cc == '\0')) {

    bVar1 = true;

  }

  local_bc.lpfnWndProc = (WNDPROC)&LAB_00439860;

  local_bc.cbClsExtra = 0;

  local_bc.cbWndExtra = 0;

  local_bc.style = 0;

  local_bc.hInstance = hInstance;

  local_bc.hIcon = LoadIconA(hInstance,(LPCSTR)0x65);

  local_bc.hbrBackground = GetStockObject(4);

  local_bc.lpszMenuName = (LPCSTR)*param_2;

  local_bc.hCursor = (HCURSOR)0x0;

  local_bc.lpszClassName = "Turbine Device Class";

  AVar3 = RegisterClassA(&local_bc);

  if ((AVar3 != 0) || (DVar6 = GetLastError(), uVar10 = extraout_ECX_02, DVar6 == 0x582)) {

    local_f8 = (-(uint)bVar1 & 0x80ca0000) + 0x82000000;

    if (param_5 != '\0') {

      local_f8 = local_f8 | 0x10000000;

    }

    nWidth = local_d4;

    iVar7 = local_d0;

    iVar8 = 0;

    if (bVar1) {

      iVar11 = GetSystemMetrics(7);

      local_f0 = iVar11;

      iVar7 = GetSystemMetrics(8);

      iVar8 = GetSystemMetrics(4);

      iVar9 = GetSystemMetrics(0);

      nWidth = local_d4 + iVar11 * 2;

      iVar7 = iVar8 + iVar7 * 2 + local_d0;

      iVar11 = iVar9 / 2 - nWidth / 2;

      iVar8 = GetSystemMetrics(1);

      iVar8 = iVar8 / 2 - iVar7 / 2;

      BVar5 = SystemParametersInfoA(0x30,0x10,&local_ec,0);

      if (BVar5 != 0) {

        local_f4 = local_e0 - local_e8;

        if (local_e4 - local_ec < nWidth) {

          iVar11 = local_ec - local_f0;

        }

        else {

          if (local_e4 < nWidth + iVar11) {

            iVar11 = (local_e4 - local_ec) - nWidth;

          }

          if (iVar11 < local_ec) {

            iVar11 = local_ec;

          }

        }

        if (iVar7 <= local_f4) {

          if (local_e0 < iVar8 + iVar7) {

            iVar8 = local_f4 - iVar7;

          }

          if (local_e8 <= iVar8) goto LAB_0043bd0b;

        }

        iVar8 = local_e8;

      }

    }

LAB_0043bd0b:

    DAT_008381a4 = CreateWindowExA(0,"Turbine Device Class",(LPCSTR)*param_2,local_f8,iVar11,iVar8,

                                   nWidth,iVar7,(HWND)0x0,(HMENU)0x0,local_dc,(LPVOID)0x0);

    uVar10 = extraout_ECX_03;

    if (DAT_008381a4 != (HWND)0x0) {

      iVar11 = FUN_005df0f5(0x3f8);

      if (iVar11 == 0) {

        DAT_00837ff4 = (int *)0x0;

      }

      else {

        DAT_00837ff4 = (int *)FUN_006895d0();

      }

      cVar2 = (**(code **)(*DAT_00837ff4 + 4))(DAT_008381a4);

      if (cVar2 != '\x01') {

        return 0;

      }

      if (param_4 != '\0') {

        ShowWindow(DAT_008381a4,1);

        UpdateWindow(DAT_008381a4);

        SetForegroundWindow(DAT_008381a4);

        SetActiveWindow(DAT_008381a4);

        SetWindowPos(DAT_008381a4,(HWND)(-1 - (uint)((char)unaff_retaddr != '\0')),0,0,0,0,0x153);

      }

      cVar2 = FUN_0043ad90(local_d8,local_d4,unaff_retaddr);

      if (cVar2 == '\0') {

        return 0;

      }

      iVar11 = FUN_005df0f5(8);

      if (iVar11 == 0) {

        DAT_008381ac = 0;

      }

      else {

        DAT_008381ac = FUN_00439210();

      }

      FUN_00401340("Exits the application");

      FUN_00401340(&DAT_00799d90);

      FUN_00436580(&LAB_00439830,&local_f8,&stack0xffffff04);

      FUN_004011b0();

      FUN_004011b0();

      FUN_00401340("Exits the application");

      FUN_00401340(&DAT_00799d88);

      FUN_00436580(&LAB_00439830,&local_f8,&stack0xffffff04);

      FUN_004011b0();

      FUN_004011b0();

      FUN_00401340("Restarts the rendering engine and applies new display settings");

      FUN_00401340("UpdatePresentation");

      FUN_00436580(FUN_0043a510,&local_f8,&stack0xffffff04);

      FUN_004011b0();

      FUN_004011b0();

      FUN_00401340("ForceDisplayResolution [<Width> <Height>]");

      FUN_00401340(

                  "Forces the display resolution to the specified width and height.  Pass no parameters to restore normal resolution."

                  );

      FUN_00401340("ForceDisplayResolution");

      FUN_004366d0(FUN_0043aa70,&local_f8,&stack0xffffff04,&local_f4);

      FUN_004011b0();

      FUN_004011b0();

      FUN_004011b0();

      SetThreadExecutionState(0x80000001);

      DAT_00838196 = 1;

      return 1;

    }

  }

  uVar15 = 0;

  FUN_00402730(&DAT_00795320);

  uVar14 = extraout_ECX_04;

  FUN_00402730(&DAT_00795320);

  uVar13 = extraout_ECX_05;

  FUN_00402730(&DAT_00795320);

  uVar12 = 0x7f;

LAB_0043bfcd:

  FUN_0043d090(uVar12,uVar13,uVar14,uVar10,uVar15);

  DAT_00838194 = 1;

  return 0;

}





// --- FUN_0043bff0 at 0x0043BFF0 (size: 460) ---


HBITMAP FUN_0043bff0(int param_1,int param_2,HBITMAP param_3)



{

  int iVar1;

  int iVar2;

  uint uVar3;

  uint uVar4;

  HDC hdc;

  HDC hdc_00;

  HDC hdc_01;

  HBITMAP ho;

  uint uVar5;

  uint *puVar6;

  uint uVar7;

  uint *local_40;

  HBITMAP local_3c;

  HGDIOBJ local_38;

  HGDIOBJ local_34;

  HDC local_30;

  BITMAPINFO local_2c;

  

  local_2c.bmiHeader.biWidth = param_3[1].unused;

  local_2c.bmiHeader.biHeight = param_3[2].unused;

  local_2c.bmiHeader.biSizeImage = local_2c.bmiHeader.biHeight * local_2c.bmiHeader.biWidth * 4;

  local_2c.bmiHeader.biSize = 0x28;

  local_2c.bmiHeader.biPlanes = 1;

  local_2c.bmiHeader.biBitCount = 0x20;

  local_2c.bmiHeader.biCompression = 0;

  local_2c.bmiHeader.biXPelsPerMeter = 0;

  local_2c.bmiHeader.biYPelsPerMeter = 0;

  local_2c.bmiHeader.biClrUsed = 0;

  local_2c.bmiHeader.biClrImportant = 0;

  local_40 = (uint *)0x0;

  local_3c = CreateDIBSection((HDC)0x0,&local_2c,0,&local_40,(HANDLE)0x0,0);

  if (local_3c == (HBITMAP)0x0) {

    return (HBITMAP)0x0;

  }

  uVar4 = *(uint *)(param_3 + 2);

  uVar7 = 0;

  puVar6 = local_40;

  if (uVar4 != 0) {

    do {

      iVar1 = param_3->unused;

      iVar2 = param_3[3].unused;

      uVar5 = 0;

      if (param_3[1].unused != 0) {

        do {

          uVar3 = *(uint *)(iVar1 + (((uVar4 - uVar7) + -1) * iVar2 & 0xfffffffc) + uVar5 * 4);

          if ((uVar3 & 0xff000000) < 0x40000000) {

            *puVar6 = 0;

          }

          else {

            *puVar6 = uVar3;

          }

          puVar6 = puVar6 + 1;

          uVar5 = uVar5 + 1;

        } while (uVar5 < *(uint *)(param_3 + 1));

      }

      uVar4 = *(uint *)(param_3 + 2);

      uVar7 = uVar7 + 1;

    } while (uVar7 < uVar4);

  }

  hdc = GetDC((HWND)0x0);

  local_30 = hdc;

  hdc_00 = CreateCompatibleDC(hdc);

  hdc_01 = CreateCompatibleDC(hdc);

  ho = CreateCompatibleBitmap(hdc,param_1,param_2);

  if ((hdc_00 == (HDC)0x0) || (hdc_01 == (HDC)0x0)) {

    if (ho != (HBITMAP)0x0) {

      DeleteObject(ho);

      param_3 = (HBITMAP)0x0;

      ho = param_3;

    }

  }

  else if (ho != (HBITMAP)0x0) {

    local_34 = SelectObject(hdc_01,local_3c);

    local_38 = SelectObject(hdc_00,ho);

    PatBlt(hdc_00,0,0,param_1,param_2,0x42);

    BitBlt(hdc_00,0,0,param_3[1].unused,param_3[2].unused,hdc_01,0,0,0xcc0020);

    SelectObject(hdc_00,local_38);

    SelectObject(hdc_01,local_34);

    hdc = local_30;

  }

  param_3 = ho;

  if (hdc != (HDC)0x0) {

    ReleaseDC((HWND)0x0,hdc);

  }

  if (hdc_01 != (HDC)0x0) {

    DeleteDC(hdc_01);

  }

  if (hdc_00 != (HDC)0x0) {

    DeleteDC(hdc_00);

  }

  DeleteObject(local_3c);

  return param_3;

}





// --- FUN_0043c1c0 at 0x0043C1C0 (size: 602) ---


HBITMAP FUN_0043c1c0(uint param_1,uint param_2,int *param_3,char param_4)



{

  int iVar1;

  int iVar2;

  byte *lpBits;

  uint uVar3;

  HBITMAP pHVar4;

  byte bVar5;

  uint uVar6;

  uint uVar7;

  byte bVar8;

  uint uVar9;

  int iVar10;

  uint uVar11;

  byte *pbVar12;

  uint local_c;

  uint local_8;

  

  local_c = param_2;

  if (param_4 != '\0') {

    local_c = param_2 * 2;

  }

  uVar9 = (param_1 >> 3) * local_c;

  bVar8 = 0xff;

  if ((uVar9 == 0) || ((param_1 & 7) != 0)) {

    return (HBITMAP)0x0;

  }

  lpBits = (byte *)thunk_FUN_005df0f5(uVar9);

  pbVar12 = lpBits;

  for (uVar6 = uVar9 >> 2; uVar6 != 0; uVar6 = uVar6 - 1) {

    pbVar12[0] = 0xff;

    pbVar12[1] = 0xff;

    pbVar12[2] = 0xff;

    pbVar12[3] = 0xff;

    pbVar12 = pbVar12 + 4;

  }

  for (uVar6 = uVar9 & 3; uVar6 != 0; uVar6 = uVar6 - 1) {

    *pbVar12 = 0xff;

    pbVar12 = pbVar12 + 1;

  }

  uVar6 = param_1;

  if ((uint)param_3[1] < param_1) {

    uVar6 = param_3[1];

  }

  if ((uint)param_3[2] < param_2) {

    param_2 = param_3[2];

  }

  local_8 = 0;

  pbVar12 = lpBits;

  if (param_2 != 0) {

    do {

      iVar1 = param_3[3];

      iVar2 = *param_3;

      iVar10 = 0;

      uVar3 = 0;

      if (uVar6 == 0) {

LAB_0043c2af:

        iVar10 = 8 - iVar10;

        do {

          bVar8 = bVar8 << 1 | 1;

          iVar10 = iVar10 + -1;

        } while (iVar10 != 0);

      }

      else {

        do {

          if (iVar10 == 8) {

            *pbVar12 = bVar8;

            pbVar12 = pbVar12 + 1;

            bVar8 = 0xff;

            iVar10 = 0;

          }

          iVar10 = iVar10 + 1;

          bVar8 = bVar8 << 1 |

                  (*(uint *)(iVar2 + (iVar1 * local_8 & 0xfffffffc) + uVar3 * 4) & 0xff000000) <

                  0x40000000;

          uVar3 = uVar3 + 1;

        } while (uVar3 < uVar6);

        if (iVar10 < 8) goto LAB_0043c2af;

      }

      *pbVar12 = bVar8;

      pbVar12 = pbVar12 + 1;

      if (uVar6 < param_1) {

        pbVar12 = pbVar12 + (param_1 - uVar6 >> 3);

      }

      local_8 = local_8 + 1;

    } while (local_8 < param_2);

  }

  if (param_4 != '\0') {

    pbVar12 = lpBits + (int)uVar9 / 2;

    _param_4 = 0;

    if (param_2 != 0) {

      do {

        iVar1 = param_3[3];

        iVar2 = *param_3;

        iVar10 = 0;

        uVar9 = 0;

        if (uVar6 == 0) {

LAB_0043c3a3:

          iVar10 = 8 - iVar10;

          do {

            bVar8 = bVar8 << 1 | 1;

            iVar10 = iVar10 + -1;

          } while (iVar10 != 0);

        }

        else {

          do {

            if (iVar10 == 8) {

              *pbVar12 = bVar8;

              pbVar12 = pbVar12 + 1;

              bVar8 = 0xff;

              iVar10 = 0;

            }

            uVar3 = *(uint *)(iVar2 + (iVar1 * _param_4 & 0xfffffffc) + uVar9 * 4);

            iVar10 = iVar10 + 1;

            if ((uVar3 & 0xff000000) < 0x40000000) {

LAB_0043c391:

              bVar5 = 0;

            }

            else {

              uVar11 = uVar3 >> 8 & 0xff;

              uVar7 = uVar3 >> 0x10 & 0xff;

              if (uVar7 <= uVar11) {

                uVar7 = uVar11;

              }

              if (uVar7 <= (uVar3 & 0xff)) {

                uVar7 = uVar3 & 0xff;

              }

              if (uVar7 < 0x41) goto LAB_0043c391;

              bVar5 = 1;

            }

            bVar8 = bVar8 << 1 | bVar5;

            uVar9 = uVar9 + 1;

          } while (uVar9 < uVar6);

          if (iVar10 < 8) goto LAB_0043c3a3;

        }

        *pbVar12 = bVar8;

        pbVar12 = pbVar12 + 1;

        if (uVar6 < param_1) {

          pbVar12 = pbVar12 + (param_1 - uVar6 >> 3);

        }

        _param_4 = _param_4 + 1;

      } while (_param_4 < param_2);

    }

  }

  pHVar4 = CreateBitmap(param_1,local_c,1,1,lpBits);

  operator_delete__(lpBits);

  return pHVar4;

}





// --- FUN_0043c420 at 0x0043C420 (size: 125) ---


HICON FUN_0043c420(undefined4 param_1,DWORD param_2,DWORD param_3,undefined4 param_4)



{

  HBITMAP ho;

  HICON pHVar1;

  HBITMAP ho_00;

  ICONINFO local_14;

  

  pHVar1 = (HICON)0x0;

  ho_00 = (HBITMAP)0x0;

  if ((char)param_4 == '\0') {

    ho_00 = (HBITMAP)FUN_0043bff0(0x20,0x20,param_1);

  }

  ho = (HBITMAP)FUN_0043c1c0(0x20,0x20,param_1,param_4);

  if (ho != (HBITMAP)0x0) {

    local_14.fIcon = 0;

    local_14.xHotspot = param_2;

    local_14.yHotspot = param_3;

    local_14.hbmMask = ho;

    local_14.hbmColor = ho_00;

    pHVar1 = CreateIconIndirect(&local_14);

  }

  DeleteObject(ho_00);

  DeleteObject(ho);

  return pHVar1;

}





// --- FUN_0043c4a0 at 0x0043C4A0 (size: 365) ---


bool FUN_0043c4a0(undefined4 param_1,undefined4 param_2,int param_3,undefined4 *param_4)



{

  char cVar1;

  int *piVar2;

  undefined4 uVar3;

  bool bVar4;

  undefined1 auStack_4c [4];

  int iStack_48;

  int iStack_44;

  undefined4 uStack_40;

  undefined **ppuStack_3c;

  undefined4 uStack_c;

  undefined4 uStack_8;

  undefined4 uStack_4;

  

  *param_4 = 0;

  bVar4 = false;

  if (((*(uint *)(param_3 + 0xa0) < 0x21) && (*(uint *)(param_3 + 0xa4) < 0x21)) &&

     (*(int *)(param_3 + 0x114) == 0)) {

    piVar2 = (int *)(**(code **)(*DAT_00870340 + 0x10))();

    cVar1 = (**(code **)(*piVar2 + 0x58))(0x20,0x20,0x15,1);

    if (cVar1 != '\0') {

      FUN_00443040(&DAT_00838328);

      FUN_00441d40(piVar2,0,0,*(int *)(param_3 + 0xa0) + -1,*(int *)(param_3 + 0xa4) + -1);

      FUN_00443290(param_3 + 0xac);

      cVar1 = (**(code **)(*piVar2 + 0x60))(&stack0xffffffa4,2,&uStack_4,&stack0x00000000);

      bVar4 = cVar1 != '\0';

      if (bVar4) {

        iStack_48 = piVar2[0x28];

        iStack_44 = piVar2[0x29];

        uStack_40 = uStack_4;

        uVar3 = FUN_0043c420(auStack_4c,uStack_c,uStack_8,DAT_00870340[0xc9] == 0);

        *param_4 = uVar3;

        (**(code **)(*piVar2 + 100))();

      }

      ppuStack_3c = &PTR_FUN_00799d14;

      FUN_00440f40();

    }

    (**(code **)(*piVar2 + 0x14))();

    return bVar4;

  }

  return false;

}





// --- FUN_0043c610 at 0x0043C610 (size: 44) ---


void __fastcall FUN_0043c610(undefined4 *param_1)



{

  int *piVar1;

  

  *param_1 = &PTR_FUN_00801670;

  piVar1 = (int *)FUN_0043c680();

  if (piVar1 != (int *)0x0) {

    (**(code **)(*piVar1 + 0xc))(param_1);

  }

  if (DAT_00842adc != 0) {

    FUN_00508980(param_1);

  }

  return;

}





// --- FUN_0043c640 at 0x0043C640 (size: 24) ---


undefined4 * __fastcall FUN_0043c640(undefined4 *param_1)



{

  FUN_0043c6c0();

  *param_1 = &PTR_FUN_00799fc4;

  DAT_00838374 = param_1;

  return param_1;

}





// --- FUN_0043c660 at 0x0043C660 (size: 21) ---


void __fastcall FUN_0043c660(undefined4 *param_1)



{

  *param_1 = &PTR_FUN_00799fc4;

  DAT_00838374 = 0;

  FUN_0043c850();

  return;

}





// --- FUN_0043c680 at 0x0043C680 (size: 6) ---


undefined4 FUN_0043c680(void)



{

  return DAT_00838374;

}





// --- FUN_0043c690 at 0x0043C690 (size: 46) ---


undefined4 * __thiscall FUN_0043c690(undefined4 *param_1,byte param_2)



{

  *param_1 = &PTR_FUN_00799fc4;

  DAT_00838374 = 0;

  FUN_0043c850();

  if ((param_2 & 1) != 0) {

    operator_delete(param_1);

  }

  return param_1;

}





// --- FUN_0043c6c0 at 0x0043C6C0 (size: 16) ---


void __fastcall FUN_0043c6c0(undefined4 *param_1)



{

  *param_1 = &PTR_FUN_00799fd8;

  param_1[1] = 0;

  return;

}





// --- FUN_0043c6d0 at 0x0043C6D0 (size: 44) ---


void __fastcall FUN_0043c6d0(undefined4 *param_1)



{

  *param_1 = &PTR_FUN_00799ff0;

  if ((undefined4 *)param_1[0x18] != param_1 + 1) {

    operator_delete__((undefined4 *)param_1[0x18]);

  }

  param_1[0x18] = 0;

  param_1[0x19] = 0;

  param_1[0x1a] = 0;

  param_1[0x1b] = 0;

  return;

}





// --- FUN_0043c700 at 0x0043C700 (size: 64) ---


undefined4 * __thiscall FUN_0043c700(undefined4 *param_1,byte param_2)



{

  *param_1 = &PTR_FUN_00799ff0;

  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_0043c740 at 0x0043C740 (size: 127) ---


void __fastcall FUN_0043c740(int param_1)



{

  int iVar1;

  int *piVar2;

  int iVar3;

  undefined1 local_c [12];

  

  if (*(int *)(param_1 + 4) != 0) {

    piVar2 = (int *)FUN_0052dcf0(local_c);

    iVar3 = piVar2[2];

    iVar1 = *piVar2;

    piVar2 = (int *)piVar2[1];

    while (iVar3 != 0) {

      do {

        if (*(undefined4 **)(iVar3 + 8) != (undefined4 *)0x0) {

          (**(code **)**(undefined4 **)(iVar3 + 8))(1);

        }

        iVar3 = *(int *)(iVar3 + 4);

      } while (iVar3 != 0);

      do {

        piVar2 = piVar2 + 1;

        if (piVar2 == (int *)(*(int *)(iVar1 + 0x60) + *(int *)(iVar1 + 0x68) * 4))

        goto LAB_0043c7a3;

        iVar3 = *piVar2;

      } while (iVar3 == 0);

    }

LAB_0043c7a3:

    if (*(undefined4 **)(param_1 + 4) != (undefined4 *)0x0) {

      (**(code **)**(undefined4 **)(param_1 + 4))(1);

    }

    *(undefined4 *)(param_1 + 4) = 0;

  }

  return;

}





// --- FUN_0043c800 at 0x0043C800 (size: 66) ---


uint __thiscall FUN_0043c800(int param_1,undefined4 *param_2)



{

  undefined4 *puVar1;

  uint in_EAX;

  int iVar2;

  

  puVar1 = *(undefined4 **)(param_1 + 4);

  if (puVar1 == (undefined4 *)0x0) {

    return in_EAX & 0xffffff00;

  }

  iVar2 = puVar1[1];

  *(int *)(param_1 + 4) = iVar2;

  if (iVar2 == 0) {

    *(undefined4 *)(param_1 + 8) = 0;

  }

  else {

    *(undefined4 *)(iVar2 + 8) = 0;

  }

  *param_2 = *puVar1;

  operator_delete(puVar1);

  iVar2 = *(int *)(param_1 + 0xc) + -1;

  *(int *)(param_1 + 0xc) = iVar2;

  return CONCAT31((int3)((uint)iVar2 >> 8),1);

}





// --- FUN_0043c850 at 0x0043C850 (size: 11) ---


void __fastcall FUN_0043c850(undefined4 *param_1)



{

  *param_1 = &PTR_FUN_00799fd8;

  FUN_0043c740();

  return;

}





// --- FUN_0043c950 at 0x0043C950 (size: 36) ---


undefined4 * __thiscall FUN_0043c950(undefined4 *param_1,byte param_2)



{

  *param_1 = &PTR_FUN_00799fd8;

  FUN_0043c740();

  if ((param_2 & 1) != 0) {

    operator_delete(param_1);

  }

  return param_1;

}





// --- FUN_0043c980 at 0x0043C980 (size: 143) ---


undefined4 * __thiscall FUN_0043c980(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_00799ff0;

  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_0043cb20 at 0x0043CB20 (size: 50) ---


undefined4 * __thiscall FUN_0043cb20(undefined4 *param_1,byte param_2)



{

  *param_1 = &PTR_FUN_00799ff4;

  FUN_005870f0();

  FUN_0043c6d0();

  if ((param_2 & 1) != 0) {

    operator_delete(param_1);

  }

  return param_1;

}





// --- FUN_0043cb60 at 0x0043CB60 (size: 340) ---


/* WARNING: Function: __chkstk replaced with injection: alloca_probe */



undefined4 * __thiscall FUN_0043cb60(undefined4 *param_1,undefined4 *param_2,ushort param_3)



{

  int iVar1;

  LONG LVar2;

  undefined4 *puVar3;

  undefined *local_300c;

  CHAR local_3008 [4072];

  undefined1 auStack_2020 [24];

  undefined2 local_2008;

  undefined4 local_2006 [2046];

  undefined4 uStack_c;

  

  uStack_c = 0x43cb70;

  if ((HINSTANCE)*param_1 == (HINSTANCE)0x0) {

    local_300c = PTR_DAT_00818340;

    InterlockedIncrement((LONG *)(PTR_DAT_00818340 + -0x10));

    FUN_004027b0(&local_300c,L"<corestrings.dll not found. Tried to print stringID %d>",param_3);

    *param_2 = local_300c;

    InterlockedIncrement((LONG *)(local_300c + -0x10));

    puVar3 = (undefined4 *)(local_300c + -0x14);

    LVar2 = InterlockedDecrement((LONG *)(local_300c + -0x10));

    if ((LVar2 == 0) && (puVar3 != (undefined4 *)0x0)) {

      (**(code **)*puVar3)(1);

    }

  }

  else {

    iVar1 = LoadStringA((HINSTANCE)*param_1,(uint)param_3,local_3008,0x1000);

    if (iVar1 != 0) {

      local_2008 = 0;

      puVar3 = local_2006;

      for (iVar1 = 0x7ff; iVar1 != 0; iVar1 = iVar1 + -1) {

        *puVar3 = 0;

        puVar3 = puVar3 + 1;

      }

      *(undefined2 *)puVar3 = 0;

      (*(code *)PTR_FUN_00837394)(0,1,local_3008,0xffffffff,&local_2008,0x1000);

      FUN_00402730(auStack_2020);

      return param_2;

    }

    local_300c = PTR_DAT_00818340;

    InterlockedIncrement((LONG *)(PTR_DAT_00818340 + -0x10));

    FUN_004027b0(&local_300c,L"<corestrings.dll is missing string ID %d>",(uint)param_3);

    *param_2 = local_300c;

    InterlockedIncrement((LONG *)(local_300c + -0x10));

    puVar3 = (undefined4 *)(local_300c + -0x14);

    LVar2 = InterlockedDecrement((LONG *)(local_300c + -0x10));

    if ((LVar2 == 0) && (puVar3 != (undefined4 *)0x0)) {

      (**(code **)*puVar3)(1);

      return param_2;

    }

  }

  return param_2;

}





// --- FUN_0043ccc0 at 0x0043CCC0 (size: 440) ---


int * FUN_0043ccc0(int *param_1,undefined4 param_2,int param_3,int param_4,int param_5)



{

  size_t sVar1;

  LONG LVar2;

  wchar_t *pwVar3;

  undefined4 *puVar4;

  int local_8;

  wchar_t *local_4;

  

  FUN_0043cb60(&local_8,param_2);

  sVar1 = wcslen(L"%1");

  FUN_004022d0(sVar1);

  wcscpy(local_4,L"%1");

  FUN_0040d870(&local_4,&param_3);

  pwVar3 = local_4 + -10;

  LVar2 = InterlockedDecrement((LONG *)(local_4 + -8));

  if ((LVar2 == 0) && (pwVar3 != (wchar_t *)0x0)) {

    (*(code *)**(undefined4 **)pwVar3)(1);

  }

  sVar1 = wcslen(L"%2");

  FUN_004022d0(sVar1);

  wcscpy(local_4,L"%2");

  FUN_0040d870(&local_4,&param_4);

  pwVar3 = local_4 + -10;

  LVar2 = InterlockedDecrement((LONG *)(local_4 + -8));

  if ((LVar2 == 0) && (pwVar3 != (wchar_t *)0x0)) {

    (*(code *)**(undefined4 **)pwVar3)(1);

  }

  sVar1 = wcslen(L"%3");

  FUN_004022d0(sVar1);

  wcscpy(local_4,L"%3");

  FUN_0040d870(&local_4,&param_5);

  LVar2 = InterlockedDecrement((LONG *)(local_4 + -8));

  if ((LVar2 == 0) && (local_4 + -10 != (wchar_t *)0x0)) {

    (*(code *)**(undefined4 **)(local_4 + -10))(1);

  }

  *param_1 = local_8;

  InterlockedIncrement((LONG *)(local_8 + -0x10));

  LVar2 = InterlockedDecrement((LONG *)(local_8 + -0x10));

  if ((LVar2 == 0) && ((undefined4 *)(local_8 + -0x14) != (undefined4 *)0x0)) {

    (*(code *)**(undefined4 **)(local_8 + -0x14))(1);

  }

  puVar4 = (undefined4 *)(param_3 + -0x14);

  LVar2 = InterlockedDecrement((LONG *)(param_3 + -0x10));

  if ((LVar2 == 0) && (puVar4 != (undefined4 *)0x0)) {

    (**(code **)*puVar4)(1);

  }

  puVar4 = (undefined4 *)(param_4 + -0x14);

  LVar2 = InterlockedDecrement((LONG *)(param_4 + -0x10));

  if ((LVar2 == 0) && (puVar4 != (undefined4 *)0x0)) {

    (**(code **)*puVar4)(1);

  }

  puVar4 = (undefined4 *)(param_5 + -0x14);

  LVar2 = InterlockedDecrement((LONG *)(param_5 + -0x10));

  if ((LVar2 == 0) && (puVar4 != (undefined4 *)0x0)) {

    (**(code **)*puVar4)(1);

  }

  return param_1;

}





// --- FUN_0043ce80 at 0x0043CE80 (size: 519) ---


void FUN_0043ce80(int param_1,int param_2)



{

  size_t sVar1;

  LONG LVar2;

  undefined4 uVar3;

  undefined4 extraout_ECX;

  undefined4 extraout_ECX_00;

  undefined4 extraout_ECX_01;

  undefined4 extraout_ECX_02;

  undefined4 extraout_ECX_03;

  undefined4 extraout_ECX_04;

  undefined4 unaff_EBX;

  undefined4 *puVar4;

  int unaff_EDI;

  undefined8 uVar5;

  undefined4 uVar6;

  undefined4 uVar7;

  wchar_t *local_1c;

  int local_18;

  int local_14;

  undefined8 local_10;

  undefined4 local_4;

  

  uVar5 = FUN_0040e560();

  local_4 = (undefined4)((ulonglong)uVar5 >> 0x20);

  local_10 = FUN_0040e620();

  sVar1 = wcslen(L"ERROR");

  FUN_004022d0(sVar1);

  wcscpy(local_1c,L"ERROR");

  uVar3 = 0x50000;

  if (param_2 == 0) {

    uVar7 = 0x50000;

    FUN_00402730(&DAT_00795320);

    uVar6 = extraout_ECX_03;

    FUN_00402730(&DAT_00795320);

    uVar3 = extraout_ECX_04;

    FUN_00402730(&DAT_00795320);

    uVar3 = FUN_0043ccc0(&local_14,0xb,uVar3,uVar6,uVar7);

    FUN_00402070(uVar3);

    puVar4 = (undefined4 *)(local_14 + -0x14);

    LVar2 = InterlockedDecrement((LONG *)(local_14 + -0x10));

    if ((LVar2 == 0) && (puVar4 != (undefined4 *)0x0)) {

      (**(code **)*puVar4)(1);

    }

    uVar3 = 0x50010;

  }

  else if (param_2 == 1) {

    uVar7 = 0x50000;

    FUN_00402730(&DAT_00795320);

    uVar6 = extraout_ECX_01;

    FUN_00402730(&DAT_00795320);

    uVar3 = extraout_ECX_02;

    FUN_00402730(&DAT_00795320);

    uVar3 = FUN_0043ccc0(&local_18,0xc,uVar3,uVar6,uVar7);

    FUN_00402070(uVar3);

    LVar2 = InterlockedDecrement((LONG *)(local_18 + -0x10));

    if ((LVar2 == 0) && ((undefined4 *)(local_18 + -0x14) != (undefined4 *)0x0)) {

      (*(code *)**(undefined4 **)(local_18 + -0x14))(1);

    }

    uVar3 = 0x50030;

  }

  else if (param_2 == 2) {

    uVar7 = 0x50000;

    FUN_00402730(&DAT_00795320);

    uVar6 = extraout_ECX;

    FUN_00402730(&DAT_00795320);

    uVar3 = extraout_ECX_00;

    FUN_00402730(&DAT_00795320);

    uVar3 = FUN_0043ccc0(&param_2,0xd,uVar3,uVar6,uVar7);

    FUN_00402070(uVar3);

    puVar4 = (undefined4 *)(param_2 + -0x14);

    LVar2 = InterlockedDecrement((LONG *)(param_2 + -0x10));

    if ((LVar2 == 0) && (puVar4 != (undefined4 *)0x0)) {

      (**(code **)*puVar4)(1);

    }

    uVar3 = 0x50040;

  }

  (*(code *)PTR_FUN_008373ac)(0,param_1,local_1c,uVar3);

  FUN_0040e690((int)uVar5,local_14);

  FUN_0040e5d0(unaff_EBX,local_1c);

  LVar2 = InterlockedDecrement((LONG *)(unaff_EDI + -0x10));

  if ((LVar2 == 0) && ((undefined4 *)(unaff_EDI + -0x14) != (undefined4 *)0x0)) {

    (*(code *)**(undefined4 **)(unaff_EDI + -0x14))(1);

  }

  LVar2 = InterlockedDecrement((LONG *)(param_1 + -0x10));

  if ((LVar2 == 0) && ((undefined4 *)(param_1 + -0x14) != (undefined4 *)0x0)) {

    (*(code *)**(undefined4 **)(param_1 + -0x14))(1);

  }

  return;

}





// --- FUN_0043d090 at 0x0043D090 (size: 180) ---


void FUN_0043d090(undefined4 param_1,int param_2,int param_3,int param_4)



{

  LONG LVar1;

  int iVar2;

  int iVar3;

  int iVar4;

  undefined4 uStack_18;

  

  iVar4 = param_4;

  InterlockedIncrement((LONG *)(param_4 + -0x10));

  iVar3 = param_3;

  InterlockedIncrement((LONG *)(param_3 + -0x10));

  iVar2 = param_2;

  InterlockedIncrement((LONG *)(param_2 + -0x10));

  FUN_0043ccc0(&uStack_18,param_1,iVar2,iVar3,iVar4);

  FUN_0043ce80();

  uStack_18 = 0x43d102;

  LVar1 = InterlockedDecrement((LONG *)(param_2 + -0x10));

  if ((LVar1 == 0) && ((undefined4 *)(param_2 + -0x14) != (undefined4 *)0x0)) {

    uStack_18 = 0x43d112;

    (*(code *)**(undefined4 **)(param_2 + -0x14))();

  }

  uStack_18 = 0x43d118;

  LVar1 = InterlockedDecrement((LONG *)(param_3 + -0x10));

  if ((LVar1 == 0) && ((undefined4 *)(param_3 + -0x14) != (undefined4 *)0x0)) {

    uStack_18 = 0x43d128;

    (*(code *)**(undefined4 **)(param_3 + -0x14))();

  }

  uStack_18 = 0x43d12e;

  LVar1 = InterlockedDecrement((LONG *)(param_4 + -0x10));

  if ((LVar1 == 0) && ((undefined4 *)(param_4 + -0x14) != (undefined4 *)0x0)) {

    uStack_18 = 0x43d13f;

    (*(code *)**(undefined4 **)(param_4 + -0x14))();

  }

  return;

}





// --- FUN_0043d150 at 0x0043D150 (size: 314) ---


void __fastcall FUN_0043d150(int param_1)



{

  uint uVar1;

  uint uVar2;

  uint uVar3;

  uint uVar4;

  byte bVar5;

  byte bVar6;

  byte bVar7;

  byte bVar8;

  char cVar9;

  int iVar10;

  byte bVar11;

  

  uVar1 = *(uint *)(param_1 + 0x10);

  bVar5 = 0;

  do {

    if ((uVar1 >> (bVar5 & 0x1f) & 1) != 0) goto LAB_0043d174;

    bVar5 = bVar5 + 1;

  } while (bVar5 < 0x20);

  bVar5 = 0;

LAB_0043d174:

  uVar2 = *(uint *)(param_1 + 0x14);

  *(byte *)(param_1 + 0x24) = bVar5;

  bVar6 = 0;

  do {

    if ((uVar2 >> (bVar6 & 0x1f) & 1) != 0) goto LAB_0043d196;

    bVar6 = bVar6 + 1;

  } while (bVar6 < 0x20);

  bVar6 = 0;

LAB_0043d196:

  uVar3 = *(uint *)(param_1 + 0x18);

  *(byte *)(param_1 + 0x25) = bVar6;

  bVar7 = 0;

  do {

    if ((uVar3 >> (bVar7 & 0x1f) & 1) != 0) goto LAB_0043d1b8;

    bVar7 = bVar7 + 1;

  } while (bVar7 < 0x20);

  bVar7 = 0;

LAB_0043d1b8:

  uVar4 = *(uint *)(param_1 + 0x1c);

  *(byte *)(param_1 + 0x26) = bVar7;

  bVar8 = 0;

  do {

    if ((uVar4 >> (bVar8 & 0x1f) & 1) != 0) goto LAB_0043d1d6;

    bVar8 = bVar8 + 1;

  } while (bVar8 < 0x20);

  bVar8 = 0;

LAB_0043d1d6:

  cVar9 = '\0';

  *(byte *)(param_1 + 0x27) = bVar8;

  bVar11 = 0;

  iVar10 = 0x20;

  do {

    cVar9 = cVar9 + ((byte)(uVar1 >> (bVar11 & 0x1f)) & 1);

    bVar11 = bVar11 + 1;

    iVar10 = iVar10 + -1;

  } while (iVar10 != 0);

  *(char *)(param_1 + 0x20) = cVar9;

  cVar9 = '\0';

  bVar11 = 0;

  iVar10 = 0x20;

  do {

    cVar9 = cVar9 + ((byte)(uVar2 >> (bVar11 & 0x1f)) & 1);

    bVar11 = bVar11 + 1;

    iVar10 = iVar10 + -1;

  } while (iVar10 != 0);

  *(char *)(param_1 + 0x21) = cVar9;

  cVar9 = '\0';

  bVar11 = 0;

  iVar10 = 0x20;

  do {

    cVar9 = cVar9 + ((byte)(uVar3 >> (bVar11 & 0x1f)) & 1);

    bVar11 = bVar11 + 1;

    iVar10 = iVar10 + -1;

  } while (iVar10 != 0);

  *(char *)(param_1 + 0x22) = cVar9;

  cVar9 = '\0';

  bVar11 = 0;

  iVar10 = 0x20;

  do {

    cVar9 = cVar9 + ((byte)(uVar4 >> (bVar11 & 0x1f)) & 1);

    bVar11 = bVar11 + 1;

    iVar10 = iVar10 + -1;

  } while (iVar10 != 0);

  *(char *)(param_1 + 0x23) = cVar9;

  *(uint *)(param_1 + 0x28) = uVar1 >> (bVar5 & 0x1f);

  *(uint *)(param_1 + 0x2c) = uVar2 >> (bVar6 & 0x1f);

  *(uint *)(param_1 + 0x30) = uVar3 >> (bVar7 & 0x1f);

  *(uint *)(param_1 + 0x34) = uVar4 >> (bVar8 & 0x1f);

  return;

}





// --- FUN_0043d290 at 0x0043D290 (size: 1050) ---


undefined4 __thiscall FUN_0043d290(int *param_1,int param_2)



{

  *param_1 = param_2;

  param_1[1] = 0;

  param_1[2] = 0;

  *(undefined1 *)(param_1 + 3) = 0;

  param_1[7] = 0;

  param_1[6] = 0;

  param_1[5] = 0;

  param_1[4] = 0;

  *(undefined1 *)((int)param_1 + 0x27) = 0;

  *(undefined1 *)((int)param_1 + 0x26) = 0;

  *(undefined1 *)((int)param_1 + 0x25) = 0;

  *(undefined1 *)(param_1 + 9) = 0;

  if (0x29 < param_2) {

    if (param_2 < 0xf2) {

      if (param_2 != 0xf1) {

        switch(param_2) {

        case 0x3c:

          param_1[1] = 9;

          *(undefined1 *)(param_1 + 3) = 0x10;

          param_1[4] = 0xff00;

          param_1[5] = 0xff;

          param_1[6] = 0;

          FUN_0043d150();

          return 1;

        default:

          return 0;

        case 0x46:

        case 0x50:

          param_1[1] = 2;

          *(undefined1 *)(param_1 + 3) = 0x10;

          param_1[7] = 0xffff;

          FUN_0043d150();

          return 1;

        case 0x47:

          param_1[1] = 2;

          *(undefined1 *)(param_1 + 3) = 0x20;

          param_1[7] = -1;

          FUN_0043d150();

          return 1;

        case 0x49:

          param_1[1] = 2;

          *(undefined1 *)(param_1 + 3) = 0x10;

          param_1[7] = 0xfffe;

          FUN_0043d150();

          return 1;

        case 0x4b:

        case 0x4d:

        case 0x4f:

          param_1[1] = 2;

          *(undefined1 *)(param_1 + 3) = 0x20;

          param_1[7] = -0x100;

          FUN_0043d150();

          return 1;

        case 0x65:

          param_1[1] = 0x40;

          *(undefined1 *)(param_1 + 3) = 0x10;

          FUN_0043d150();

          return 1;

        case 0xf0:

          param_1[1] = 3;

          *(undefined1 *)(param_1 + 3) = 0x20;

          param_1[4] = -0x1000000;

          param_1[5] = 0xff0000;

          param_1[6] = 0xff00;

          param_1[7] = 0xff;

          FUN_0043d150();

          return 1;

        }

      }

      param_1[1] = 3;

      *(undefined1 *)(param_1 + 3) = 0x20;

      param_1[4] = 0xff;

      param_1[5] = 0xff00;

      param_1[6] = 0xff0000;

      param_1[7] = -0x1000000;

      FUN_0043d150();

      return 1;

    }

    if (0x31545844 < param_2) {

      if (param_2 < 0x34545845) {

        if (param_2 == 0x34545844) {

          param_1[2] = 0x34545844;

        }

        else if (param_2 == 0x32545844) {

          param_1[2] = 0x32545844;

        }

        else {

          if (param_2 != 0x33545844) {

            return 0;

          }

          param_1[2] = 0x33545844;

        }

      }

      else {

        if (param_2 != 0x35545844) {

          return 0;

        }

        param_1[2] = 0x35545844;

      }

      param_1[1] = 4;

      *(undefined1 *)(param_1 + 3) = 8;

      FUN_0043d150();

      return 1;

    }

    if (param_2 == 0x31545844) {

      param_1[1] = 4;

      param_1[2] = 0x31545844;

      *(undefined1 *)(param_1 + 3) = 4;

      FUN_0043d150();

      return 1;

    }

    if (0xf4 < param_2) {

      if (param_2 != 500) {

        return 0;

      }

      param_1[1] = 0x11;

      FUN_0043d150();

      return 1;

    }

    if (param_2 == 0xf4) goto switchD_0043d2de_caseD_8;

    if (param_2 == 0xf2) {

      param_1[1] = 1;

      *(undefined1 *)(param_1 + 3) = 0x18;

      param_1[4] = 0xff;

      param_1[5] = 0xff00;

      param_1[6] = 0xff0000;

      FUN_0043d150();

      return 1;

    }

    if (param_2 != 0xf3) {

      return 0;

    }

switchD_0043d2de_caseD_0:

    *(undefined1 *)(param_1 + 3) = 0x18;

LAB_0043d5b5:

    param_1[1] = 1;

LAB_0043d5b8:

    param_1[4] = 0xff0000;

    param_1[5] = 0xff00;

    param_1[6] = 0xff;

    FUN_0043d150();

    return 1;

  }

  if (param_2 == 0x29) {

    param_1[1] = 0x40;

    *(undefined1 *)(param_1 + 3) = 8;

    FUN_0043d150();

    return 1;

  }

  switch(param_2 + -0x14) {

  case 0:

    goto switchD_0043d2de_caseD_0;

  case 1:

    param_1[1] = 3;

    *(undefined1 *)(param_1 + 3) = 0x20;

    param_1[7] = -0x1000000;

    goto LAB_0043d5b8;

  case 2:

    *(undefined1 *)(param_1 + 3) = 0x20;

    goto LAB_0043d5b5;

  case 3:

    param_1[1] = 1;

    param_1[4] = 0xf800;

    param_1[5] = 0x7e0;

    *(undefined1 *)(param_1 + 3) = 0x10;

    param_1[6] = 0x1f;

    FUN_0043d150();

    return 1;

  case 4:

    param_1[1] = 1;

    break;

  case 5:

    param_1[1] = 3;

    param_1[7] = 0x8000;

    break;

  case 6:

    param_1[1] = 3;

    param_1[7] = 0xf000;

    goto LAB_0043d376;

  default:

    return 0;

  case 8:

switchD_0043d2de_caseD_8:

    param_1[1] = 2;

    param_1[7] = 0xff;

    *(undefined1 *)(param_1 + 3) = 8;

    FUN_0043d150();

    return 1;

  case 10:

    param_1[1] = 1;

LAB_0043d376:

    *(undefined1 *)(param_1 + 3) = 0x10;

    param_1[4] = 0xf00;

    param_1[5] = 0xf0;

    param_1[6] = 0xf;

    FUN_0043d150();

    return 1;

  case 0xb:

    param_1[1] = 3;

    *(undefined1 *)(param_1 + 3) = 0x20;

    param_1[7] = -0x40000000;

    param_1[6] = 0x3ff00000;

    param_1[5] = 0xffc00;

    param_1[4] = 0x3ff;

    FUN_0043d150();

    return 1;

  case 0xc:

    param_1[1] = 3;

    param_1[7] = -0x1000000;

    goto LAB_0043d3db;

  case 0xd:

    param_1[1] = 1;

LAB_0043d3db:

    *(undefined1 *)(param_1 + 3) = 0x20;

    param_1[6] = 0xff0000;

    param_1[5] = 0xff00;

    param_1[4] = 0xff;

    FUN_0043d150();

    return 1;

  case 0xf:

    param_1[1] = 3;

    *(undefined1 *)(param_1 + 3) = 0x20;

    param_1[7] = -0x40000000;

    param_1[4] = 0x3ff00000;

    param_1[5] = 0xffc00;

    param_1[6] = 0x3ff;

    FUN_0043d150();

    return 1;

  }

  param_1[4] = 0x7c00;

  param_1[5] = 0x3e0;

  *(undefined1 *)(param_1 + 3) = 0x10;

  param_1[6] = 0x1f;

  FUN_0043d150();

  return 1;

}





// --- FUN_0043d7d0 at 0x0043D7D0 (size: 19) ---


undefined4 __thiscall FUN_0043d7d0(undefined4 param_1,undefined4 param_2)



{

  FUN_0043d290(param_2);

  return param_1;

}





// --- FUN_0043d7f0 at 0x0043D7F0 (size: 40) ---


undefined4 FUN_0043d7f0(int param_1,int param_2)



{

  if ((((-1 < param_1) && (-1 < param_2)) && (param_1 < 0x7f8)) && (param_2 < 0x7f8)) {

    return 1;

  }

  return 0;

}





// --- FUN_0043d820 at 0x0043D820 (size: 75) ---


undefined4 FUN_0043d820(uint param_1,uint *param_2,uint *param_3)



{

  uint uVar1;

  

  if (param_1 != 0) {

    *param_2 = param_1 >> 0x15 & 0x7f8;

    uVar1 = (param_1 >> 0x10 & 0xff) * 8;

    *param_3 = uVar1;

    if (((-1 < (int)*param_2) && ((int)*param_2 < 0x7f8)) && (uVar1 < 0x7f8)) {

      return 1;

    }

  }

  return 0;

}





// --- FUN_0043d870 at 0x0043D870 (size: 30) ---


undefined4 FUN_0043d870(float param_1,float param_2,float param_3)



{

  if (ABS(param_1 - param_2) < param_3 != (ABS(param_1 - param_2) == param_3)) {

    return 1;

  }

  return 0;

}





// --- FUN_0043d890 at 0x0043D890 (size: 31) ---


void __thiscall FUN_0043d890(float *param_1,float param_2)



{

  *param_1 = param_2 * *param_1;

  param_1[1] = param_2 * param_1[1];

  param_1[2] = param_2 * param_1[2];

  return;

}





// --- FUN_0043d8b0 at 0x0043D8B0 (size: 37) ---


void __thiscall FUN_0043d8b0(float *param_1,float *param_2,float *param_3)



{

  float fVar1;

  float fVar2;

  float fVar3;

  float fVar4;

  

  fVar1 = param_3[1];

  fVar2 = param_1[1];

  fVar3 = param_3[2];

  fVar4 = param_1[2];

  *param_2 = *param_3 + *param_1;

  param_2[1] = fVar1 + fVar2;

  param_2[2] = fVar3 + fVar4;

  return;

}





// --- FUN_0043d8e0 at 0x0043D8E0 (size: 37) ---


void __thiscall FUN_0043d8e0(float *param_1,float *param_2,float *param_3)



{

  float fVar1;

  float fVar2;

  float fVar3;

  float fVar4;

  

  fVar1 = param_1[1];

  fVar2 = param_3[1];

  fVar3 = param_1[2];

  fVar4 = param_3[2];

  *param_2 = *param_1 - *param_3;

  param_2[1] = fVar1 - fVar2;

  param_2[2] = fVar3 - fVar4;

  return;

}





// --- FUN_0043d910 at 0x0043D910 (size: 37) ---


void __thiscall FUN_0043d910(float *param_1,float *param_2,float param_3)



{

  float fVar1;

  float fVar2;

  

  fVar1 = param_1[1];

  fVar2 = param_1[2];

  *param_2 = param_3 * *param_1;

  param_2[1] = param_3 * fVar1;

  param_2[2] = param_3 * fVar2;

  return;

}





// --- FUN_0043d940 at 0x0043D940 (size: 128) ---


/* WARNING: Globals starting with '_' overlap smaller symbols at the same address */



void __thiscall FUN_0043d940(float *param_1,float *param_2,float *param_3)



{

  float fVar1;

  

  fVar1 = _DAT_007938b0 /

          (param_1[7] * param_2[1] + param_1[0xb] * param_2[2] + param_1[3] * *param_2 +

          param_1[0xf]);

  *param_3 = (*param_2 * *param_1 + param_1[4] * param_2[1] + param_1[8] * param_2[2] + param_1[0xc]

             ) * fVar1;

  param_3[1] = (param_1[5] * param_2[1] + param_1[9] * param_2[2] + param_1[1] * *param_2 +

               param_1[0xd]) * fVar1;

  param_3[2] = (param_1[6] * param_2[1] + param_1[10] * param_2[2] + param_1[2] * *param_2 +

               param_1[0xe]) * fVar1;

  return;

}





// --- FUN_0043d9c0 at 0x0043D9C0 (size: 530) ---


void __thiscall FUN_0043d9c0(float *param_1,float *param_2,float *param_3)



{

  *param_1 = param_2[3] * param_3[0xc] +

             param_2[1] * param_3[4] + param_3[8] * param_2[2] + *param_2 * *param_3;

  param_1[1] = param_3[0xd] * param_2[3] +

               param_2[1] * param_3[5] + *param_2 * param_3[1] + param_3[9] * param_2[2];

  param_1[2] = param_3[0xe] * param_2[3] +

               param_2[1] * param_3[6] + param_3[10] * param_2[2] + *param_2 * param_3[2];

  param_1[3] = param_3[0xb] * param_2[2] +

               param_3[3] * *param_2 + param_2[3] * param_3[0xf] + param_2[1] * param_3[7];

  param_1[4] = param_2[4] * *param_3 +

               param_2[7] * param_3[0xc] + param_3[8] * param_2[6] + param_2[5] * param_3[4];

  param_1[5] = param_3[0xd] * param_2[7] +

               param_3[9] * param_2[6] + param_3[5] * param_2[5] + param_2[4] * param_3[1];

  param_1[6] = param_2[4] * param_3[2] +

               param_3[0xe] * param_2[7] + param_3[10] * param_2[6] + param_2[5] * param_3[6];

  param_1[7] = param_2[5] * param_3[7] +

               param_2[6] * param_3[0xb] + param_2[7] * param_3[0xf] + param_2[4] * param_3[3];

  param_1[8] = param_2[8] * *param_3 +

               param_2[0xb] * param_3[0xc] + param_3[8] * param_2[10] + param_2[9] * param_3[4];

  param_1[9] = param_3[9] * param_2[10] +

               param_3[0xd] * param_2[0xb] + param_3[5] * param_2[9] + param_2[8] * param_3[1];

  param_1[10] = param_2[8] * param_3[2] +

                param_3[10] * param_2[10] + param_3[0xe] * param_2[0xb] + param_2[9] * param_3[6];

  param_1[0xb] = param_2[9] * param_3[7] +

                 param_2[10] * param_3[0xb] + param_2[0xb] * param_3[0xf] + param_2[8] * param_3[3];

  param_1[0xc] = param_2[0xc] * *param_3 +

                 param_2[0xf] * param_3[0xc] + param_3[8] * param_2[0xe] + param_2[0xd] * param_3[4]

  ;

  param_1[0xd] = param_3[9] * param_2[0xe] +

                 param_3[0xd] * param_2[0xf] + param_3[5] * param_2[0xd] + param_2[0xc] * param_3[1]

  ;

  param_1[0xe] = param_2[0xc] * param_3[2] +

                 param_3[10] * param_2[0xe] +

                 param_3[0xe] * param_2[0xf] + param_2[0xd] * param_3[6];

  param_1[0xf] = param_2[0xd] * param_3[7] +

                 param_2[0xe] * param_3[0xb] +

                 param_2[0xf] * param_3[0xf] + param_2[0xc] * param_3[3];

  return;

}





// --- FUN_0043dbe0 at 0x0043DBE0 (size: 80) ---


uint FUN_0043dbe0(void)



{

  int iVar1;

  uint uVar2;

  uint uVar3;

  uint uVar4;

  

  iVar1 = FUN_005df4c4();

  uVar2 = FUN_005df4c4();

  uVar3 = FUN_005df4c4();

  uVar4 = FUN_005df4c4();

  return uVar4 | ((iVar1 << 8 | uVar2) << 8 | uVar3) << 8;

}





// --- FUN_0043dc30 at 0x0043DC30 (size: 24) ---


float * FUN_0043dc30(float *param_1,float *param_2)



{

  if (*param_1 <= *param_2) {

    param_2 = param_1;

  }

  return param_2;

}





// --- FUN_0043dc50 at 0x0043DC50 (size: 32) ---


void __thiscall FUN_0043dc50(int param_1,undefined4 *param_2)



{

  *(undefined4 *)(param_1 + 0x7c) = *param_2;

  *(undefined4 *)(param_1 + 0x80) = param_2[1];

  *(undefined4 *)(param_1 + 0x84) = param_2[2];

  *(undefined4 *)(param_1 + 0x88) = param_2[3];

  return;

}





// --- FUN_0043dc70 at 0x0043DC70 (size: 94) ---


void FUN_0043dc70(void)



{

  undefined4 local_10;

  undefined4 local_c;

  undefined4 local_8;

  undefined4 local_4;

  

  if ((char)DAT_00870340[0x2b] == '\0') {

    DAT_00818c08 = DAT_00818c08 + 1;

    local_10 = 0;

    local_c = 0;

    local_8 = 0;

    local_4 = 0x3f800000;

    (**(code **)(*DAT_00870340 + 0x2c))(7,&local_10,0x3f800000);

    (**(code **)(*DAT_00870340 + 0x20))();

  }

  return;

}





// --- FUN_0043dcd0 at 0x0043DCD0 (size: 88) ---


/* WARNING: Globals starting with '_' overlap smaller symbols at the same address */



void FUN_0043dcd0(int param_1,int param_2,float *param_3,float *param_4)



{

  float fVar1;

  float fVar2;

  float fVar3;

  

  fVar1 = _DAT_007938b0 / (float)*(int *)(DAT_00870340 + 0x94);

  fVar3 = _DAT_007938b0 / (float)*(int *)(DAT_00870340 + 0x98);

  fVar2 = (float)param_1 * fVar1;

  *param_3 = (fVar2 + fVar2) - _DAT_007938b0;

  fVar2 = (float)param_2 * fVar3;

  *param_4 = -((fVar2 + fVar2) - _DAT_007938b0);

  *param_3 = *param_3 - fVar1;

  *param_4 = *param_4 - fVar3;

  return;

}





// --- FUN_0043dd30 at 0x0043DD30 (size: 2315) ---


/* WARNING: Globals starting with '_' overlap smaller symbols at the same address */



undefined4 FUN_0043dd30(void)



{

  char cVar1;

  uint uVar2;

  undefined4 *puVar3;

  undefined4 unaff_ESI;

  int *unaff_EDI;

  float10 fVar4;

  float10 fVar5;

  int *local_54;

  float local_50 [20];

  

  if ((_DAT_00838750 & 1) == 0) {

    _DAT_00838750 = _DAT_00838750 | 1;

    _DAT_00838748 = 0x769cf0e0;

    _DAT_0083874c = 0x3fe41b2f;

  }

  fVar4 = (float10)_DAT_00795610;

  uVar2 = 0;

  do {

    uVar2 = uVar2 + 1;

    fVar5 = (float10)fcos(fVar4);

    local_50[uVar2 * 2 + -2] = (float)fVar5;

    fVar5 = (float10)fsin(fVar4);

    local_50[uVar2 * 2 + -1] = (float)fVar5;

    fVar4 = fVar4 + (float10)(double)CONCAT44(_DAT_0083874c,_DAT_00838748);

  } while (uVar2 < 10);

  cVar1 = FUN_00446600(0,0,4,0xffffffff,0x6c,2,1,1,&local_54);

  if (cVar1 != '\0') {

    puVar3 = (undefined4 *)(**(code **)(*local_54 + 0xc))(0,0x6c);

    puVar3[1] = local_54;

    *puVar3 = unaff_ESI;

    puVar3[2] = 0x3f000000;

    puVar3[3] = local_50[0];

    puVar3[4] = local_50[1];

    puVar3[5] = 0x3f000000;

    puVar3[6] = local_50[2];

    puVar3[7] = local_50[3];

    puVar3[8] = 0x3f000000;

    puVar3[9] = unaff_ESI;

    puVar3[10] = local_54;

    puVar3[0xb] = 0x3f000000;

    puVar3[0xc] = local_50[2];

    puVar3[0xd] = local_50[3];

    puVar3[0xe] = 0x3f000000;

    puVar3[0xf] = local_50[4];

    puVar3[0x10] = local_50[5];

    puVar3[0x11] = 0x3f000000;

    puVar3[0x12] = unaff_ESI;

    puVar3[0x13] = local_54;

    puVar3[0x14] = 0x3f000000;

    puVar3[0x15] = local_50[4];

    puVar3[0x16] = local_50[5];

    puVar3[0x17] = 0x3f000000;

    puVar3[0x18] = local_50[6];

    puVar3[0x19] = local_50[7];

    puVar3[0x1a] = 0x3f000000;

    puVar3[0x1b] = unaff_ESI;

    puVar3[0x1c] = local_54;

    puVar3[0x1d] = 0x3f000000;

    puVar3[0x1e] = local_50[6];

    puVar3[0x1f] = local_50[7];

    puVar3[0x20] = 0x3f000000;

    puVar3[0x21] = local_50[8];

    puVar3[0x22] = local_50[9];

    puVar3[0x23] = 0x3f000000;

    puVar3[0x24] = unaff_ESI;

    puVar3[0x26] = 0x3f000000;

    puVar3[0x25] = local_54;

    puVar3[0x29] = 0x3f000000;

    puVar3[0x27] = local_50[8];

    puVar3[0x28] = local_50[9];

    puVar3[0x2a] = local_50[10];

    puVar3[0x2c] = 0x3f000000;

    puVar3[0x2b] = local_50[0xb];

    puVar3[0x2d] = unaff_ESI;

    puVar3[0x2e] = local_54;

    puVar3[0x2f] = 0x3f000000;

    puVar3[0x30] = local_50[10];

    puVar3[0x31] = local_50[0xb];

    puVar3[0x32] = 0x3f000000;

    puVar3[0x33] = local_50[0xc];

    puVar3[0x34] = local_50[0xd];

    puVar3[0x35] = 0x3f000000;

    puVar3[0x36] = unaff_ESI;

    puVar3[0x37] = local_54;

    puVar3[0x38] = 0x3f000000;

    puVar3[0x39] = local_50[0xc];

    puVar3[0x3a] = local_50[0xd];

    puVar3[0x3b] = 0x3f000000;

    puVar3[0x3c] = local_50[0xe];

    puVar3[0x3d] = local_50[0xf];

    puVar3[0x3e] = 0x3f000000;

    puVar3[0x3f] = unaff_ESI;

    puVar3[0x40] = local_54;

    puVar3[0x41] = 0x3f000000;

    puVar3[0x42] = local_50[0xe];

    puVar3[0x43] = local_50[0xf];

    puVar3[0x44] = 0x3f000000;

    puVar3[0x45] = local_50[0x10];

    puVar3[0x46] = local_50[0x11];

    puVar3[0x47] = 0x3f000000;

    puVar3[0x48] = local_50[2];

    puVar3[0x49] = local_50[3];

    puVar3[0x4a] = 0xbf000000;

    puVar3[0x4b] = local_50[0];

    puVar3[0x4c] = local_50[1];

    puVar3[0x4d] = 0xbf000000;

    puVar3[0x50] = 0xbf000000;

    puVar3[0x4e] = unaff_ESI;

    puVar3[0x4f] = local_54;

    puVar3[0x51] = local_50[4];

    puVar3[0x53] = 0xbf000000;

    puVar3[0x52] = local_50[5];

    puVar3[0x54] = local_50[2];

    puVar3[0x55] = local_50[3];

    puVar3[0x56] = 0xbf000000;

    puVar3[0x57] = unaff_ESI;

    puVar3[0x58] = local_54;

    puVar3[0x59] = 0xbf000000;

    puVar3[0x5a] = local_50[6];

    puVar3[0x5b] = local_50[7];

    puVar3[0x5c] = 0xbf000000;

    puVar3[0x5d] = local_50[4];

    puVar3[0x5e] = local_50[5];

    puVar3[0x5f] = 0xbf000000;

    puVar3[0x60] = unaff_ESI;

    puVar3[0x61] = local_54;

    puVar3[0x62] = 0xbf000000;

    puVar3[99] = local_50[8];

    puVar3[100] = local_50[9];

    puVar3[0x65] = 0xbf000000;

    puVar3[0x66] = local_50[6];

    puVar3[0x67] = local_50[7];

    puVar3[0x68] = 0xbf000000;

    puVar3[0x69] = unaff_ESI;

    puVar3[0x6a] = local_54;

    puVar3[0x6b] = 0xbf000000;

    puVar3[0x6c] = local_50[10];

    puVar3[0x6d] = local_50[0xb];

    puVar3[0x6e] = 0xbf000000;

    puVar3[0x6f] = local_50[8];

    puVar3[0x70] = local_50[9];

    puVar3[0x71] = 0xbf000000;

    puVar3[0x72] = unaff_ESI;

    puVar3[0x73] = local_54;

    puVar3[0x74] = 0xbf000000;

    puVar3[0x75] = local_50[0xc];

    puVar3[0x77] = 0xbf000000;

    puVar3[0x76] = local_50[0xd];

    puVar3[0x7a] = 0xbf000000;

    puVar3[0x78] = local_50[10];

    puVar3[0x79] = local_50[0xb];

    puVar3[0x7b] = unaff_ESI;

    puVar3[0x7d] = 0xbf000000;

    puVar3[0x7c] = local_54;

    puVar3[0x7e] = local_50[0xe];

    puVar3[0x80] = 0xbf000000;

    puVar3[0x7f] = local_50[0xf];

    puVar3[0x81] = local_50[0xc];

    puVar3[0x82] = local_50[0xd];

    puVar3[0x83] = 0xbf000000;

    puVar3[0x84] = unaff_ESI;

    puVar3[0x85] = local_54;

    puVar3[0x86] = 0xbf000000;

    puVar3[0x87] = local_50[0x10];

    puVar3[0x88] = local_50[0x11];

    puVar3[0x89] = 0xbf000000;

    puVar3[0x8a] = local_50[0xe];

    puVar3[0x8b] = local_50[0xf];

    puVar3[0x8c] = 0xbf000000;

    puVar3[0x8d] = unaff_ESI;

    puVar3[0x8e] = local_54;

    puVar3[0x8f] = 0xbf000000;

    puVar3[0x90] = unaff_ESI;

    puVar3[0x91] = local_54;

    puVar3[0x92] = 0xbf000000;

    puVar3[0x93] = local_50[0];

    puVar3[0x94] = local_50[1];

    puVar3[0x95] = 0x3f000000;

    puVar3[0x96] = unaff_ESI;

    puVar3[0x97] = local_54;

    puVar3[0x98] = 0x3f000000;

    puVar3[0x99] = unaff_ESI;

    puVar3[0x9a] = local_54;

    puVar3[0x9b] = 0xbf000000;

    puVar3[0x9c] = local_50[0];

    puVar3[0x9d] = local_50[1];

    puVar3[0x9e] = 0xbf000000;

    puVar3[0xa1] = 0x3f000000;

    puVar3[0x9f] = local_50[0];

    puVar3[0xa0] = local_50[1];

    puVar3[0xa2] = local_50[0];

    puVar3[0xa4] = 0xbf000000;

    puVar3[0xa3] = local_50[1];

    puVar3[0xa5] = local_50[2];

    puVar3[0xa7] = 0x3f000000;

    puVar3[0xa6] = local_50[3];

    puVar3[0xa8] = local_50[0];

    puVar3[0xa9] = local_50[1];

    puVar3[0xaa] = 0x3f000000;

    puVar3[0xab] = local_50[0];

    puVar3[0xac] = local_50[1];

    puVar3[0xad] = 0xbf000000;

    puVar3[0xae] = local_50[2];

    puVar3[0xaf] = local_50[3];

    puVar3[0xb0] = 0xbf000000;

    puVar3[0xb1] = local_50[2];

    puVar3[0xb2] = local_50[3];

    puVar3[0xb3] = 0x3f000000;

    puVar3[0xb4] = local_50[2];

    puVar3[0xb5] = local_50[3];

    puVar3[0xb6] = 0xbf000000;

    puVar3[0xb7] = local_50[4];

    puVar3[0xb8] = local_50[5];

    puVar3[0xb9] = 0x3f000000;

    puVar3[0xba] = local_50[2];

    puVar3[0xbb] = local_50[3];

    puVar3[0xbc] = 0x3f000000;

    puVar3[0xbd] = local_50[2];

    puVar3[0xbe] = local_50[3];

    puVar3[0xbf] = 0xbf000000;

    puVar3[0xc0] = local_50[4];

    puVar3[0xc1] = local_50[5];

    puVar3[0xc2] = 0xbf000000;

    puVar3[0xc3] = local_50[4];

    puVar3[0xc4] = local_50[5];

    puVar3[0xc5] = 0x3f000000;

    puVar3[0xc6] = local_50[4];

    puVar3[200] = 0xbf000000;

    puVar3[199] = local_50[5];

    puVar3[0xcb] = 0x3f000000;

    puVar3[0xc9] = local_50[6];

    puVar3[0xca] = local_50[7];

    puVar3[0xcc] = local_50[4];

    puVar3[0xce] = 0x3f000000;

    puVar3[0xcd] = local_50[5];

    puVar3[0xcf] = local_50[4];

    puVar3[0xd1] = 0xbf000000;

    puVar3[0xd0] = local_50[5];

    puVar3[0xd2] = local_50[6];

    puVar3[0xd3] = local_50[7];

    puVar3[0xd4] = 0xbf000000;

    puVar3[0xd5] = local_50[6];

    puVar3[0xd6] = local_50[7];

    puVar3[0xd7] = 0x3f000000;

    puVar3[0xd8] = local_50[6];

    puVar3[0xd9] = local_50[7];

    puVar3[0xda] = 0xbf000000;

    puVar3[0xdb] = local_50[8];

    puVar3[0xdc] = local_50[9];

    puVar3[0xdd] = 0x3f000000;

    puVar3[0xde] = local_50[6];

    puVar3[0xdf] = local_50[7];

    puVar3[0xe0] = 0x3f000000;

    puVar3[0xe1] = local_50[6];

    puVar3[0xe2] = local_50[7];

    puVar3[0xe3] = 0xbf000000;

    puVar3[0xe4] = local_50[8];

    puVar3[0xe5] = local_50[9];

    puVar3[0xe6] = 0xbf000000;

    puVar3[0xe7] = local_50[8];

    puVar3[0xe8] = local_50[9];

    puVar3[0xe9] = 0x3f000000;

    puVar3[0xea] = local_50[8];

    puVar3[0xeb] = local_50[9];

    puVar3[0xec] = 0xbf000000;

    puVar3[0xed] = local_50[10];

    puVar3[0xee] = local_50[0xb];

    puVar3[0xef] = 0x3f000000;

    puVar3[0xf2] = 0x3f000000;

    puVar3[0xf0] = local_50[8];

    puVar3[0xf1] = local_50[9];

    puVar3[0xf3] = local_50[8];

    puVar3[0xf5] = 0xbf000000;

    puVar3[0xf4] = local_50[9];

    puVar3[0xf6] = local_50[10];

    puVar3[0xf8] = 0xbf000000;

    puVar3[0xf7] = local_50[0xb];

    puVar3[0xf9] = local_50[10];

    puVar3[0xfa] = local_50[0xb];

    puVar3[0xfb] = 0x3f000000;

    puVar3[0xfc] = local_50[10];

    puVar3[0xfd] = local_50[0xb];

    puVar3[0xfe] = 0xbf000000;

    puVar3[0xff] = local_50[0xc];

    puVar3[0x100] = local_50[0xd];

    puVar3[0x101] = 0x3f000000;

    puVar3[0x102] = local_50[10];

    puVar3[0x103] = local_50[0xb];

    puVar3[0x104] = 0x3f000000;

    puVar3[0x105] = local_50[10];

    puVar3[0x106] = local_50[0xb];

    puVar3[0x107] = 0xbf000000;

    puVar3[0x108] = local_50[0xc];

    puVar3[0x109] = local_50[0xd];

    puVar3[0x10a] = 0xbf000000;

    puVar3[0x10b] = local_50[0xc];

    puVar3[0x10c] = local_50[0xd];

    puVar3[0x10d] = 0x3f000000;

    puVar3[0x10e] = local_50[0xc];

    puVar3[0x10f] = local_50[0xd];

    puVar3[0x110] = 0xbf000000;

    puVar3[0x111] = local_50[0xe];

    puVar3[0x112] = local_50[0xf];

    puVar3[0x113] = 0x3f000000;

    puVar3[0x114] = local_50[0xc];

    puVar3[0x115] = local_50[0xd];

    puVar3[0x116] = 0x3f000000;

    puVar3[0x117] = local_50[0xc];

    puVar3[0x119] = 0xbf000000;

    puVar3[0x118] = local_50[0xd];

    puVar3[0x11c] = 0xbf000000;

    puVar3[0x11a] = local_50[0xe];

    puVar3[0x11b] = local_50[0xf];

    puVar3[0x11d] = local_50[0xe];

    puVar3[0x11f] = 0x3f000000;

    puVar3[0x11e] = local_50[0xf];

    puVar3[0x120] = local_50[0xe];

    puVar3[0x122] = 0xbf000000;

    puVar3[0x121] = local_50[0xf];

    puVar3[0x123] = local_50[0x10];

    puVar3[0x124] = local_50[0x11];

    puVar3[0x125] = 0x3f000000;

    puVar3[0x126] = local_50[0xe];

    puVar3[0x127] = local_50[0xf];

    puVar3[0x128] = 0x3f000000;

    puVar3[0x129] = local_50[0xe];

    puVar3[0x12a] = local_50[0xf];

    puVar3[299] = 0xbf000000;

    puVar3[300] = local_50[0x10];

    puVar3[0x12d] = local_50[0x11];

    puVar3[0x12e] = 0xbf000000;

    puVar3[0x12f] = local_50[0x10];

    puVar3[0x130] = local_50[0x11];

    puVar3[0x131] = 0x3f000000;

    puVar3[0x132] = local_50[0x10];

    puVar3[0x133] = local_50[0x11];

    puVar3[0x134] = 0xbf000000;

    puVar3[0x135] = unaff_ESI;

    puVar3[0x136] = local_54;

    puVar3[0x137] = 0x3f000000;

    puVar3[0x138] = local_50[0x10];

    puVar3[0x139] = local_50[0x11];

    puVar3[0x13a] = 0x3f000000;

    puVar3[0x13b] = local_50[0x10];

    puVar3[0x13c] = local_50[0x11];

    puVar3[0x13d] = 0xbf000000;

    puVar3[0x13e] = unaff_ESI;

    puVar3[0x13f] = local_54;

    puVar3[0x140] = 0xbf000000;

    puVar3[0x141] = unaff_ESI;

    puVar3[0x142] = local_54;

    puVar3[0x143] = 0x3f000000;

    (**(code **)(*unaff_EDI + 0x10))(0,0);

    FUN_00446590();

    return 1;

  }

  return 0;

}





// --- FUN_0043e640 at 0x0043E640 (size: 71) ---


void FUN_0043e640(void)



{

  int iVar1;

  int iVar2;

  undefined4 *puVar3;

  undefined4 *puVar4;

  

  iVar1 = DAT_00870340;

  puVar3 = (undefined4 *)(DAT_00870340 + 200);

  puVar4 = &DAT_008386f8;

  for (iVar2 = 0x10; iVar2 != 0; iVar2 = iVar2 + -1) {

    *puVar4 = *puVar3;

    puVar3 = puVar3 + 1;

    puVar4 = puVar4 + 1;

  }

  puVar3 = (undefined4 *)(iVar1 + 0x108);

  puVar4 = &DAT_00838678;

  for (iVar2 = 0x10; iVar2 != 0; iVar2 = iVar2 + -1) {

    *puVar4 = *puVar3;

    puVar3 = puVar3 + 1;

    puVar4 = puVar4 + 1;

  }

  puVar3 = (undefined4 *)(iVar1 + 0x148);

  puVar4 = &DAT_008386b8;

  for (iVar2 = 0x10; iVar2 != 0; iVar2 = iVar2 + -1) {

    *puVar4 = *puVar3;

    puVar3 = puVar3 + 1;

    puVar4 = puVar4 + 1;

  }

  DAT_00838471 = 1;

  return;

}





// --- FUN_0043e690 at 0x0043E690 (size: 10) ---


void FUN_0043e690(void)



{

  FUN_0054f4a0();

  FUN_0054e460();

  return;

}





// --- thunk_FUN_0043dc70 at 0x0043E6A0 (size: 5) ---


void thunk_FUN_0043dc70(void)



{

  undefined4 uStack_10;

  undefined4 uStack_c;

  undefined4 uStack_8;

  undefined4 uStack_4;

  

  if ((char)DAT_00870340[0x2b] == '\0') {

    DAT_00818c08 = DAT_00818c08 + 1;

    uStack_10 = 0;

    uStack_c = 0;

    uStack_8 = 0;

    uStack_4 = 0x3f800000;

    (**(code **)(*DAT_00870340 + 0x2c))(7,&uStack_10,0x3f800000);

    (**(code **)(*DAT_00870340 + 0x20))();

  }

  return;

}





// --- FUN_0043e6b0 at 0x0043E6B0 (size: 167) ---


/* WARNING: Globals starting with '_' overlap smaller symbols at the same address */



void FUN_0043e6b0(void)



{

  float fVar1;

  uint uVar2;

  uint uVar3;

  undefined4 *puVar4;

  float10 fVar5;

  

  fVar5 = (float10)FUN_0040fad0();

  fVar1 = (float)_DAT_00795610;

  uVar2 = 0;

  do {

    uVar3 = uVar2 + 0x28;

    fVar1 = fVar1 + *(float *)((int)&DAT_008383b8 + uVar2) + *(float *)((int)&DAT_008383bc + uVar2)

            + *(float *)((int)&DAT_008383c0 + uVar2) + *(float *)((int)&DAT_008383c4 + uVar2) +

            *(float *)((int)&DAT_008383c8 + uVar2) + *(float *)((int)&DAT_008383cc + uVar2) +

            *(float *)((int)&DAT_008383d0 + uVar2) + *(float *)((int)&DAT_008383d4 + uVar2) +

            *(float *)((int)&DAT_008383d8 + uVar2) + *(float *)((int)&DAT_008383dc + uVar2);

    uVar2 = uVar3;

  } while (uVar3 < 0x50);

  DAT_00838418 = 0.0;

  if (_DAT_0079a19c < fVar1) {

    DAT_00838418 = (float)_DAT_0079a1a8 / fVar1;

  }

  puVar4 = &DAT_00838404;

  do {

    *puVar4 = puVar4[-1];

    puVar4 = puVar4 + -1;

  } while (&DAT_008383b8 < puVar4);

  DAT_008383b8 = (float)(fVar5 - (float10)_DAT_00838410);

  _DAT_00838410 = (double)fVar5;

  return;

}





// --- FUN_0043e760 at 0x0043E760 (size: 98) ---


/* WARNING: Globals starting with '_' overlap smaller symbols at the same address */



void FUN_0043e760(void)



{

  undefined4 uVar1;

  undefined4 uVar2;

  char cVar3;

  

  uVar2 = DAT_008379b4;

  uVar1 = DAT_008379b0;

  if (_DAT_0079a1b0 < (double)CONCAT44(DAT_008379b4,DAT_008379b0) - _DAT_00838428) {

    cVar3 = FUN_005a1570();

    if (cVar3 != '\0') {

      FUN_00446dc0(0,0x405e0000);

    }

    _DAT_00838428 = uVar1;

    _DAT_0083842c = uVar2;

  }

  return;

}





// --- FUN_0043e7d0 at 0x0043E7D0 (size: 174) ---


/* WARNING: Globals starting with '_' overlap smaller symbols at the same address */



void FUN_0043e7d0(float *param_1,uint param_2,uint param_3)



{

  float fVar1;

  int iVar2;

  uint uVar3;

  uint uVar4;

  

  if (param_2 >> 0x10 != param_3 >> 0x10) {

    if (param_2 == 0) {

      uVar3 = 0;

      iVar2 = 0;

    }

    else {

      uVar3 = param_2 >> 0x15 & 0x7f8;

      iVar2 = (param_2 >> 0x10 & 0xff) << 3;

    }

    uVar4 = param_2;

    if (param_3 != 0) {

      param_2 = param_3 >> 0x15 & 0x7f8;

      uVar4 = (param_3 >> 0x10 & 0xff) << 3;

    }

    fVar1 = (float)(int)(param_2 - uVar3) * _DAT_0079a128;

    param_1[2] = 0.0;

    *param_1 = fVar1;

    param_1[1] = (float)(int)(uVar4 - iVar2) * _DAT_0079a128;

    return;

  }

  *param_1 = _DAT_00838474;

  param_1[1] = DAT_00838478;

  param_1[2] = DAT_0083847c;

  return;

}





// --- FUN_0043e880 at 0x0043E880 (size: 59) ---


/* WARNING: Globals starting with '_' overlap smaller symbols at the same address */



void __fastcall FUN_0043e880(float *param_1)



{

  float fVar1;

  

  fVar1 = _DAT_007938b0 /

          SQRT(param_1[2] * param_1[2] + param_1[1] * param_1[1] + *param_1 * *param_1);

  *param_1 = fVar1 * *param_1;

  param_1[1] = fVar1 * param_1[1];

  param_1[2] = fVar1 * param_1[2];

  return;

}





// --- FUN_0043e8c0 at 0x0043E8C0 (size: 31) ---


int __thiscall FUN_0043e8c0(int param_1,int param_2)



{

  *(undefined4 *)(param_1 + 4) = *(undefined4 *)(param_2 + 4);

  FUN_00425f10(param_2 + 8);

  return param_1;

}





// --- FUN_0043e8e0 at 0x0043E8E0 (size: 28) ---


void FUN_0043e8e0(int param_1)



{

  DAT_00818c7c = *(undefined4 *)(param_1 + 4);

  FUN_00425f10(param_1 + 8);

  return;

}





// --- FUN_0043e900 at 0x0043E900 (size: 135) ---


void FUN_0043e900(int param_1)



{

  undefined4 uVar1;

  undefined4 uVar2;

  undefined4 uVar3;

  undefined4 uVar4;

  

  uVar2 = *(undefined4 *)(param_1 + 0x10);

  uVar1 = *(undefined4 *)(param_1 + 4);

  uVar3 = *(undefined4 *)(param_1 + 0x14);

  *(undefined4 *)(param_1 + 4) = *(undefined4 *)(param_1 + 8);

  uVar4 = *(undefined4 *)(param_1 + 0x18);

  *(undefined4 *)(param_1 + 8) = uVar1;

  uVar1 = *(undefined4 *)(param_1 + 0x34);

  *(undefined4 *)(param_1 + 0x10) = *(undefined4 *)(param_1 + 0x20);

  *(undefined4 *)(param_1 + 0x14) = *(undefined4 *)(param_1 + 0x28);

  *(undefined4 *)(param_1 + 0x18) = *(undefined4 *)(param_1 + 0x24);

  *(undefined4 *)(param_1 + 0x20) = uVar2;

  *(undefined4 *)(param_1 + 0x24) = uVar4;

  *(undefined4 *)(param_1 + 0x28) = uVar3;

  *(undefined4 *)(param_1 + 0x34) = *(undefined4 *)(param_1 + 0x38);

  *(undefined4 *)(param_1 + 0x38) = uVar1;

  return;

}





// --- FUN_0043e990 at 0x0043E990 (size: 135) ---


void FUN_0043e990(int param_1)



{

  undefined4 uVar1;

  undefined4 uVar2;

  undefined4 uVar3;

  undefined4 uVar4;

  

  uVar2 = *(undefined4 *)(param_1 + 4);

  uVar1 = *(undefined4 *)(param_1 + 0x10);

  uVar3 = *(undefined4 *)(param_1 + 0x14);

  *(undefined4 *)(param_1 + 0x10) = *(undefined4 *)(param_1 + 0x20);

  uVar4 = *(undefined4 *)(param_1 + 0x24);

  *(undefined4 *)(param_1 + 0x20) = uVar1;

  uVar1 = *(undefined4 *)(param_1 + 0x34);

  *(undefined4 *)(param_1 + 4) = *(undefined4 *)(param_1 + 8);

  *(undefined4 *)(param_1 + 0x14) = *(undefined4 *)(param_1 + 0x28);

  *(undefined4 *)(param_1 + 0x24) = *(undefined4 *)(param_1 + 0x18);

  *(undefined4 *)(param_1 + 8) = uVar2;

  *(undefined4 *)(param_1 + 0x18) = uVar4;

  *(undefined4 *)(param_1 + 0x28) = uVar3;

  *(undefined4 *)(param_1 + 0x34) = *(undefined4 *)(param_1 + 0x38);

  *(undefined4 *)(param_1 + 0x38) = uVar1;

  return;

}





// --- FUN_0043ea20 at 0x0043EA20 (size: 197) ---


void FUN_0043ea20(undefined1 param_1)



{

  int iVar1;

  undefined4 *puVar2;

  undefined4 *unaff_ESI;

  undefined4 *unaff_retaddr;

  

  puVar2 = (undefined4 *)(**(code **)(*DAT_0083845c + 0xc))(0,2);

  *puVar2 = *unaff_ESI;

  puVar2[1] = unaff_ESI[1];

  puVar2[2] = unaff_ESI[2];

  puVar2[5] = *unaff_retaddr;

  puVar2[6] = unaff_retaddr[1];

  puVar2[7] = unaff_retaddr[2];

  (**(code **)(*DAT_0083845c + 0x10))(0,0);

  iVar1 = **(int **)(DAT_00838454 + 0x78);

  FUN_00448200(0);

  *(undefined4 *)(**(int **)(iVar1 + 0x1c) + 0x28) = 3;

  *(undefined4 *)(**(int **)(iVar1 + 0x1c) + 0x34) = 3;

  *(undefined4 *)(iVar1 + 0x34) = 5;

  *(undefined4 *)(iVar1 + 0x38) = 6;

  *(undefined1 *)(iVar1 + 0x44) = param_1;

  *(undefined4 **)(iVar1 + 0x40) = unaff_retaddr;

  *(undefined4 *)(iVar1 + 0x48) = 1;

  FUN_00447be0(2,0,1,DAT_00838454,DAT_00838454,0,unaff_ESI,&DAT_00818d18,0,0);

  return;

}





// --- FUN_0043eaf0 at 0x0043EAF0 (size: 306) ---


void FUN_0043eaf0(undefined4 *param_1,undefined4 *param_2,undefined4 *param_3,undefined4 *param_4,

                 int param_5,undefined1 param_6,undefined4 param_7,undefined4 param_8,

                 undefined4 param_9,char param_10)



{

  int iVar1;

  undefined4 *puVar2;

  undefined4 *unaff_ESI;

  undefined4 *unaff_retaddr;

  

  puVar2 = (undefined4 *)(**(code **)(*DAT_0083845c + 0xc))(0,3);

  *puVar2 = *unaff_ESI;

  puVar2[1] = unaff_ESI[1];

  puVar2[2] = unaff_ESI[2];

  puVar2[5] = *unaff_retaddr;

  puVar2[6] = unaff_retaddr[1];

  puVar2[7] = unaff_retaddr[2];

  puVar2[10] = *param_1;

  puVar2[0xb] = param_1[1];

  puVar2[0xc] = param_1[2];

  if (param_5 != 0) {

    puVar2[3] = *param_2;

    puVar2[4] = param_2[1];

    puVar2[8] = *param_3;

    puVar2[9] = param_3[1];

    puVar2[0xd] = *param_4;

    puVar2[0xe] = param_4[1];

  }

  (**(code **)(*DAT_0083845c + 0x10))(0,0);

  iVar1 = **(int **)(DAT_00838454 + 0x78);

  FUN_00448200(param_5);

  *(uint *)(**(int **)(iVar1 + 0x1c) + 0x28) = (param_5 != 0) + 3;

  *(uint *)(**(int **)(iVar1 + 0x1c) + 0x34) = (param_10 != '\0') + 3;

  *(undefined4 *)(iVar1 + 0x34) = param_8;

  *(undefined4 *)(iVar1 + 0x38) = param_9;

  *(undefined1 *)(iVar1 + 0x44) = param_6;

  *(undefined4 *)(iVar1 + 0x48) = param_7;

  *(uint *)(iVar1 + 0x40) = (uint)((char)param_5 == '\0') * 4 + 4;

  FUN_00447be0(4,0,1,DAT_00838454,DAT_00838454,0,param_4,&DAT_00818d18,0,0);

  return;

}





// --- FUN_0043ec30 at 0x0043EC30 (size: 92) ---


void FUN_0043ec30(undefined4 param_1,undefined4 param_2,undefined4 param_3,undefined4 param_4,

                 undefined4 param_5,undefined4 param_6,undefined4 param_7,undefined4 param_8,

                 undefined4 param_9)



{

  undefined4 local_8;

  undefined4 local_4;

  

  local_4 = 0;

  local_8 = 0;

  FUN_0043eaf0(param_1,param_2,param_3,&local_8,&local_8,&local_8,0,param_4,param_5,param_6,param_7,

               param_8,param_9,0);

  return;

}





// --- FUN_0043ec90 at 0x0043EC90 (size: 117) ---


void FUN_0043ec90(int param_1,int param_2,undefined4 param_3,undefined4 param_4,undefined4 param_5,

                 undefined4 param_6,undefined4 param_7,undefined4 param_8)



{

  int iVar1;

  undefined4 local_10;

  undefined4 local_c;

  

  if (1 < param_2 + -1) {

    local_c = 0;

    local_10 = 0;

    param_2 = param_2 + -2;

    iVar1 = param_1 + 0xc;

    do {

      FUN_0043eaf0(param_1,iVar1,iVar1 + 0xc,&local_10,&local_10,&local_10,0,param_3,param_4,param_5

                   ,param_6,param_7,param_8,0);

      param_2 = param_2 + -1;

      iVar1 = iVar1 + 0xc;

    } while (param_2 != 0);

  }

  return;

}





// --- FUN_0043ed80 at 0x0043ED80 (size: 2117) ---


/* WARNING: Globals starting with '_' overlap smaller symbols at the same address */



undefined4 FUN_0043ed80(void)



{

  float fVar1;

  float fVar2;

  float fVar3;

  float fVar4;

  float fVar5;

  float fVar6;

  float fVar7;

  float fVar8;

  char cVar9;

  undefined4 *puVar10;

  float *pfVar11;

  undefined4 *puVar12;

  float *pfVar13;

  uint uVar14;

  int iVar15;

  undefined4 *puVar16;

  undefined4 *local_90;

  int *local_84;

  int local_80;

  int *local_7c;

  uint local_78;

  float local_74;

  float local_70;

  float local_6c;

  float local_68;

  float local_64;

  float local_60;

  undefined4 *local_5c;

  int local_58;

  float local_54;

  float local_50;

  float local_4c;

  float local_48;

  float local_3c;

  float local_30;

  float local_1c;

  float local_10;

  float local_4;

  

  if ((DAT_008388c0 & 1) == 0) {

    DAT_008388c0 = DAT_008388c0 | 1;

    DAT_008388b4 = 0x3f800000;

    DAT_008388b8 = 0;

    DAT_008388bc = 0;

  }

  if ((DAT_008388c0 & 2) == 0) {

    DAT_008388c0 = DAT_008388c0 | 2;

    DAT_008388a8 = 0xbf800000;

    DAT_008388ac = 0;

    DAT_008388b0 = 0;

  }

  if ((DAT_008388c0 & 4) == 0) {

    DAT_008388c0 = DAT_008388c0 | 4;

    DAT_0083889c = 0;

    DAT_008388a0 = 0x3f800000;

    DAT_008388a4 = 0;

  }

  if ((DAT_008388c0 & 8) == 0) {

    DAT_008388c0 = DAT_008388c0 | 8;

    DAT_00838890 = 0;

    DAT_00838894 = 0xbf800000;

    DAT_00838898 = 0;

  }

  if ((DAT_008388c0 & 0x10) == 0) {

    DAT_008388c0 = DAT_008388c0 | 0x10;

    DAT_00838884 = 0;

    DAT_00838888 = 0;

    DAT_0083888c = 0x3f800000;

  }

  if ((DAT_008388c0 & 0x20) == 0) {

    DAT_008388c0 = DAT_008388c0 | 0x20;

    DAT_00838878 = 0;

    DAT_0083887c = 0;

    DAT_00838880 = 0xbf800000;

  }

  if ((DAT_008388c0 & 0x40) == 0) {

    DAT_008388c0 = DAT_008388c0 | 0x40;

    DAT_00838758 = DAT_0083889c;

    DAT_0083875c = DAT_008388a0;

    DAT_00838760 = DAT_008388a4;

    DAT_00838764 = DAT_00838884;

    DAT_00838768 = DAT_00838888;

    DAT_0083876c = DAT_0083888c;

    DAT_00838770 = DAT_008388b4;

    DAT_00838774 = DAT_008388b8;

    DAT_00838778 = DAT_008388bc;

    DAT_0083877c = DAT_008388a8;

    DAT_00838780 = DAT_008388ac;

    DAT_00838784 = DAT_008388b0;

    _DAT_00838788 = DAT_00838884;

    _DAT_0083878c = DAT_00838888;

    _DAT_00838790 = DAT_0083888c;

    DAT_00838794 = DAT_0083889c;

    DAT_00838798 = DAT_008388a0;

    DAT_0083879c = DAT_008388a4;

    _DAT_008387a0 = DAT_00838890;

    _DAT_008387a4 = DAT_00838894;

    _DAT_008387a8 = DAT_00838898;

    _DAT_008387ac = DAT_00838884;

    _DAT_008387b0 = DAT_00838888;

    _DAT_008387b4 = DAT_0083888c;

    _DAT_008387b8 = DAT_008388a8;

    _DAT_008387bc = DAT_008388ac;

    _DAT_008387c0 = DAT_008388b0;

    _DAT_008387c4 = DAT_008388b4;

    _DAT_008387c8 = DAT_008388b8;

    _DAT_008387cc = DAT_008388bc;

    _DAT_008387d0 = DAT_00838884;

    _DAT_008387d4 = DAT_00838888;

    _DAT_008387d8 = DAT_0083888c;

    _DAT_008387dc = DAT_00838890;

    _DAT_008387e0 = DAT_00838894;

    _DAT_008387e4 = DAT_00838898;

    _DAT_008387e8 = DAT_00838878;

    _DAT_008387ec = DAT_0083887c;

    _DAT_008387f0 = DAT_00838880;

    _DAT_008387f4 = DAT_0083889c;

    _DAT_008387f8 = DAT_008388a0;

    _DAT_008387fc = DAT_008388a4;

    _DAT_00838800 = DAT_008388b4;

    _DAT_00838804 = DAT_008388b8;

    _DAT_00838808 = DAT_008388bc;

    _DAT_0083880c = DAT_00838878;

    _DAT_00838810 = DAT_0083887c;

    _DAT_00838814 = DAT_00838880;

    _DAT_00838818 = DAT_008388a8;

    _DAT_0083881c = DAT_008388ac;

    _DAT_00838820 = DAT_008388b0;

    _DAT_00838824 = DAT_0083889c;

    _DAT_00838828 = DAT_008388a0;

    _DAT_0083882c = DAT_008388a4;

    _DAT_00838830 = DAT_00838878;

    _DAT_00838834 = DAT_0083887c;

    _DAT_00838838 = DAT_00838880;

    _DAT_0083883c = DAT_00838890;

    _DAT_00838840 = DAT_00838894;

    _DAT_00838844 = DAT_00838898;

    _DAT_00838848 = DAT_008388a8;

    _DAT_0083884c = DAT_008388ac;

    _DAT_00838850 = DAT_008388b0;

    _DAT_00838854 = DAT_00838878;

    _DAT_00838858 = DAT_0083887c;

    _DAT_0083885c = DAT_00838880;

    _DAT_00838860 = DAT_008388b4;

    _DAT_00838864 = DAT_008388b8;

    _DAT_00838868 = DAT_008388bc;

    _DAT_0083886c = DAT_00838890;

    _DAT_00838870 = DAT_00838894;

    _DAT_00838874 = DAT_00838898;

  }

  local_90 = &DAT_00838758;

  local_78 = 1;

  local_80 = 8;

  do {

    uVar14 = local_78;

    local_58 = local_80 * 4;

    puVar10 = (undefined4 *)thunk_FUN_005df0f5(local_80 * 0x90);

    iVar15 = local_80 * 4;

    if (local_80 != 0) {

      pfVar11 = (float *)(local_90 + 4);

      pfVar13 = (float *)(puVar10 + 0x21);

      do {

        local_1c = pfVar11[4] + pfVar11[-2];

        local_68 = (pfVar11[2] + pfVar11[-4]) * _DAT_007938b8;

        local_64 = (pfVar11[3] + pfVar11[-3]) * _DAT_007938b8;

        local_60 = local_1c * _DAT_007938b8;

        fVar1 = _DAT_007938b0 /

                SQRT(local_68 * local_68 + local_64 * local_64 + local_60 * local_60);

        fVar2 = local_68 * fVar1;

        fVar3 = local_64 * fVar1;

        fVar1 = local_60 * fVar1;

        local_10 = pfVar11[1] + pfVar11[-2];

        local_74 = (pfVar11[-1] + pfVar11[-4]) * _DAT_007938b8;

        local_70 = (pfVar11[-3] + *pfVar11) * _DAT_007938b8;

        local_6c = local_10 * _DAT_007938b8;

        fVar4 = _DAT_007938b0 /

                SQRT(local_70 * local_70 + local_6c * local_6c + local_74 * local_74);

        fVar5 = local_74 * fVar4;

        fVar6 = local_70 * fVar4;

        local_84 = (int *)(local_6c * fVar4);

        local_4 = pfVar11[4] + pfVar11[1];

        local_54 = (pfVar11[2] + pfVar11[-1]) * _DAT_007938b8;

        local_50 = (pfVar11[3] + *pfVar11) * _DAT_007938b8;

        local_4c = local_4 * _DAT_007938b8;

        pfVar13[-0x21] = pfVar11[-4];

        pfVar13[-0x20] = pfVar11[-3];

        pfVar13[-0x1f] = pfVar11[-2];

        pfVar13[-0x1e] = fVar5;

        pfVar13[-0x1d] = fVar6;

        pfVar13[-0x1c] = (float)local_84;

        fVar4 = _DAT_007938b0 /

                SQRT(local_50 * local_50 + local_4c * local_4c + local_54 * local_54);

        fVar7 = local_54 * fVar4;

        fVar8 = local_50 * fVar4;

        fVar4 = local_4c * fVar4;

        pfVar13[-0x1b] = fVar2;

        pfVar13[-0x1a] = fVar3;

        pfVar13[-0x19] = fVar1;

        pfVar13[-0x18] = fVar5;

        pfVar13[-0x17] = fVar6;

        pfVar13[-0x16] = (float)local_84;

        pfVar13[-0x15] = pfVar11[-1];

        pfVar13[-0x14] = *pfVar11;

        pfVar13[-0x13] = pfVar11[1];

        pfVar13[-0x12] = fVar7;

        pfVar13[-0x11] = fVar8;

        pfVar13[-0x10] = fVar4;

        pfVar13[-0xf] = fVar2;

        pfVar13[-0xe] = fVar3;

        pfVar13[-0xd] = fVar1;

        pfVar13[-0xc] = fVar5;

        pfVar13[-0xb] = fVar6;

        pfVar13[-10] = (float)local_84;

        pfVar13[-9] = fVar7;

        pfVar13[-8] = fVar8;

        pfVar13[-7] = fVar4;

        pfVar13[-6] = fVar2;

        pfVar13[-5] = fVar3;

        pfVar13[-4] = fVar1;

        pfVar13[-3] = fVar7;

        pfVar13[-2] = fVar8;

        pfVar13[-1] = fVar4;

        *pfVar13 = pfVar11[2];

        pfVar13[1] = pfVar11[3];

        pfVar13[2] = pfVar11[4];

        pfVar11 = pfVar11 + 9;

        pfVar13 = pfVar13 + 0x24;

        local_80 = local_80 + -1;

        uVar14 = local_78;

        iVar15 = local_58;

        local_48 = local_68;

        local_3c = local_74;

        local_30 = local_54;

      } while (local_80 != 0);

    }

    local_5c = puVar10;

    if (1 < uVar14) {

      operator_delete__(local_90);

    }

    local_78 = uVar14 + 1;

    local_80 = iVar15;

    local_90 = puVar10;

  } while (local_78 < 3);

  cVar9 = FUN_00446600(0,0,4,0xffffffff,iVar15 * 3,2,1,1,&local_7c);

  if (cVar9 == '\0') {

    return 0;

  }

  puVar12 = (undefined4 *)(**(code **)(*local_7c + 0xc))(0,iVar15 * 3);

  puVar16 = puVar10;

  for (uVar14 = iVar15 * 9 & 0x3fffffff; uVar14 != 0; uVar14 = uVar14 - 1) {

    *puVar12 = *puVar16;

    puVar16 = puVar16 + 1;

    puVar12 = puVar12 + 1;

  }

  for (iVar15 = 0; iVar15 != 0; iVar15 = iVar15 + -1) {

    *(undefined1 *)puVar12 = *(undefined1 *)puVar16;

    puVar16 = (undefined4 *)((int)puVar16 + 1);

    puVar12 = (undefined4 *)((int)puVar12 + 1);

  }

  (**(code **)(*local_84 + 0x10))(0,0);

  operator_delete__(puVar10);

  FUN_00446590();

  return 1;

}





// --- FUN_0043f5d0 at 0x0043F5D0 (size: 297) ---


void FUN_0043f5d0(void)



{

  int iVar1;

  undefined4 *puVar2;

  undefined4 *puVar3;

  undefined4 local_80 [32];

  

  local_80[3] = 0;

  local_80[2] = 0;

  local_80[1] = 0;

  local_80[7] = 0;

  local_80[6] = 0;

  local_80[4] = 0;

  local_80[0xb] = 0;

  local_80[9] = 0;

  local_80[8] = 0;

  local_80[0xe] = 0;

  local_80[0xd] = 0;

  local_80[0xc] = 0;

  local_80[0xf] = 0x3f800000;

  local_80[10] = 0x3f800000;

  local_80[5] = 0x3f800000;

  local_80[0] = 0x3f800000;

  puVar2 = local_80;

  puVar3 = &DAT_008385b8;

  for (iVar1 = 0x10; iVar1 != 0; iVar1 = iVar1 + -1) {

    *puVar3 = *puVar2;

    puVar2 = puVar2 + 1;

    puVar3 = puVar3 + 1;

  }

  puVar2 = local_80;

  puVar3 = local_80 + 0x10;

  for (iVar1 = 0x10; iVar1 != 0; iVar1 = iVar1 + -1) {

    *puVar3 = *puVar2;

    puVar2 = puVar2 + 1;

    puVar3 = puVar3 + 1;

  }

  FUN_0043e900(local_80 + 0x10);

  FUN_005a4820(local_80 + 0x10);

  puVar2 = local_80;

  puVar3 = &DAT_008385f8;

  for (iVar1 = 0x10; iVar1 != 0; iVar1 = iVar1 + -1) {

    *puVar3 = *puVar2;

    puVar2 = puVar2 + 1;

    puVar3 = puVar3 + 1;

  }

  puVar2 = local_80;

  puVar3 = local_80 + 0x10;

  for (iVar1 = 0x10; iVar1 != 0; iVar1 = iVar1 + -1) {

    *puVar3 = *puVar2;

    puVar2 = puVar2 + 1;

    puVar3 = puVar3 + 1;

  }

  FUN_0043e990(local_80 + 0x10);

  FUN_005a4860(local_80 + 0x10);

  puVar2 = local_80;

  puVar3 = &DAT_00838638;

  for (iVar1 = 0x10; iVar1 != 0; iVar1 = iVar1 + -1) {

    *puVar3 = *puVar2;

    puVar2 = puVar2 + 1;

    puVar3 = puVar3 + 1;

  }

  FUN_005a4890(&DAT_00838638);

  return;

}





// --- FUN_0043f700 at 0x0043F700 (size: 175) ---


void FUN_0043f700(void)



{

  int iVar1;

  undefined4 *puVar2;

  undefined4 *puVar3;

  undefined4 local_40 [16];

  

  puVar2 = &DAT_008386f8;

  puVar3 = &DAT_008385b8;

  for (iVar1 = 0x10; iVar1 != 0; iVar1 = iVar1 + -1) {

    *puVar3 = *puVar2;

    puVar2 = puVar2 + 1;

    puVar3 = puVar3 + 1;

  }

  DAT_00838471 = 0;

  puVar2 = &DAT_008386f8;

  puVar3 = local_40;

  for (iVar1 = 0x10; iVar1 != 0; iVar1 = iVar1 + -1) {

    *puVar3 = *puVar2;

    puVar2 = puVar2 + 1;

    puVar3 = puVar3 + 1;

  }

  FUN_0043e900(local_40);

  FUN_005a4820(local_40);

  puVar2 = &DAT_00838678;

  puVar3 = &DAT_008385f8;

  for (iVar1 = 0x10; iVar1 != 0; iVar1 = iVar1 + -1) {

    *puVar3 = *puVar2;

    puVar2 = puVar2 + 1;

    puVar3 = puVar3 + 1;

  }

  puVar2 = &DAT_00838678;

  puVar3 = local_40;

  for (iVar1 = 0x10; iVar1 != 0; iVar1 = iVar1 + -1) {

    *puVar3 = *puVar2;

    puVar2 = puVar2 + 1;

    puVar3 = puVar3 + 1;

  }

  FUN_0043e990(local_40);

  FUN_005a4860(local_40);

  puVar2 = &DAT_008386b8;

  puVar3 = &DAT_00838638;

  for (iVar1 = 0x10; iVar1 != 0; iVar1 = iVar1 + -1) {

    *puVar3 = *puVar2;

    puVar2 = puVar2 + 1;

    puVar3 = puVar3 + 1;

  }

  FUN_005a4890(&DAT_00838638);

  return;

}





// --- FUN_0043f7b0 at 0x0043F7B0 (size: 60) ---


/* WARNING: Globals starting with '_' overlap smaller symbols at the same address */



undefined4 FUN_0043f7b0(void)



{

  FUN_0043e760();

  if (DAT_00838468 != 0) {

    FUN_00691060();

  }

  if (DAT_0083846c != 0) {

    FUN_005da8a0();

  }

  _DAT_008388c8 = DAT_008379b0;

  _DAT_008388cc = DAT_008379b4;

  return 1;

}





// --- FUN_0043f7f0 at 0x0043F7F0 (size: 1148) ---


/* WARNING: Globals starting with '_' overlap smaller symbols at the same address */



void FUN_0043f7f0(void)



{

  undefined4 uVar1;

  int iVar2;

  uint uVar3;

  uint uVar4;

  undefined4 *puVar5;

  LONG LVar6;

  uint uVar7;

  uint uVar8;

  float fVar9;

  float fVar10;

  float local_8c [4];

  undefined4 local_7c;

  undefined4 local_78;

  undefined4 local_74;

  undefined4 local_70;

  undefined4 local_6c;

  float local_68;

  float local_64;

  undefined4 local_60;

  undefined4 local_5c;

  undefined4 local_58;

  undefined4 local_54;

  undefined4 local_50;

  undefined4 local_4c;

  undefined4 local_48;

  undefined4 local_44;

  undefined4 local_40;

  undefined4 local_3c;

  undefined4 local_38;

  undefined4 local_34;

  float local_30 [3];

  float local_24;

  undefined4 local_20;

  float local_1c;

  float local_18;

  undefined4 local_14;

  float local_10;

  float local_c;

  undefined4 local_8;

  float local_4;

  

  if (DAT_00838420 != '\0') {

    FUN_005a4390(3);

    FUN_0043f5d0();

    local_18 = _DAT_007938b0 / (float)*(int *)(DAT_00870340 + 0x94);

    local_30[1] = 0.0;

    local_20 = 0;

    local_14 = 0;

    local_8 = 0;

    local_78 = 0;

    local_74 = 0x3d75c28f;

    local_70 = 0x3dcccccd;

    local_6c = 0x3f19999a;

    local_64 = _DAT_007938b0 / (float)*(int *)(DAT_00870340 + 0x98);

    local_68 = (local_18 * DAT_00796344 - _DAT_007938b0) - local_18;

    local_8c[0] = -(DAT_00796344 * local_64 - _DAT_007938b0) - local_64;

    local_18 = (local_18 * _DAT_0079a1e4 - _DAT_007938b0) - local_18;

    fVar9 = (float)(*(int *)(DAT_00870340 + 0x810) + 3) * local_64;

    local_1c = -((fVar9 + fVar9) - _DAT_007938b0) - local_64;

    local_30[0] = local_68;

    local_30[2] = local_8c[0];

    local_24 = local_68;

    local_10 = local_1c;

    local_c = local_18;

    local_4 = local_8c[0];

    FUN_0043ec90(local_30,4,&local_78,0,0,2,5,6);

    FUN_005a26a0();

    uVar8 = 8;

    fVar9 = local_8c[0];

    fVar10 = local_8c[0];

    do {

      switch(uVar8) {

      case 0:

        fVar9 = 0.0;

        fVar10 = 0.0;

        uVar1 = 0xff000000;

        break;

      case 1:

        fVar9 = 2.8026e-45;

        fVar10 = 2.8026e-45;

        uVar1 = 0xff000000;

        break;

      case 2:

        fVar9 = 0.0;

        fVar10 = 2.8026e-45;

        uVar1 = 0xff000000;

        break;

      case 3:

        fVar9 = 2.8026e-45;

        fVar10 = 0.0;

        uVar1 = 0xff000000;

        break;

      case 4:

        fVar9 = 1.4013e-45;

        fVar10 = 0.0;

        uVar1 = 0xff000000;

        break;

      case 5:

        fVar9 = 0.0;

        fVar10 = 1.4013e-45;

        uVar1 = 0xff000000;

        break;

      case 6:

        fVar9 = 2.8026e-45;

        fVar10 = 1.4013e-45;

        uVar1 = 0xff000000;

        break;

      case 7:

        fVar9 = 1.4013e-45;

        fVar10 = 2.8026e-45;

        uVar1 = 0xff000000;

        break;

      case 8:

        fVar9 = 1.4013e-45;

        fVar10 = 1.4013e-45;

      default:

        uVar1 = 0xffaacce0;

      }

      FUN_005a13a0(fVar9,fVar10,&DAT_0079a1dc,uVar1);

      iVar2 = FUN_005df4c4();

      if (iVar2 < 10) {

        local_50 = 0x3f800000;

        local_4c = 0x3e4ccccd;

        local_48 = 0x3e4ccccd;

        local_44 = 0x3f800000;

        local_8c[1] = 1.0;

        local_8c[3] = 0.2;

        local_8c[2] = 0.2;

      }

      else if (iVar2 < 0x14) {

        local_60 = 0x3f666666;

        local_5c = 0x3f000000;

        local_58 = 0x3e4ccccd;

        local_54 = 0x3f800000;

        local_8c[1] = 0.9;

        local_8c[3] = 0.2;

        local_8c[2] = 0.5;

      }

      else if (iVar2 < 0x1e) {

        local_40 = 0x3f666666;

        local_3c = 0x3f666666;

        local_38 = 0x3e4ccccd;

        local_34 = 0x3f800000;

        local_8c[1] = 0.9;

        local_8c[3] = 0.2;

        local_8c[2] = 0.9;

      }

      else {

        local_78 = 0x3f59999a;

        local_74 = 0x3f59999a;

        local_70 = 0x3f733333;

        local_6c = 0x3f800000;

        local_8c[1] = 0.85;

        local_8c[3] = 0.95;

        local_8c[2] = 0.85;

      }

      local_7c = 0x3f800000;

      sprintf(&DAT_008388d0,"%i",iVar2);

      if (uVar8 < 8) {

        uVar7 = 0xff000000;

      }

      else {

        iVar2 = FUN_005df4c4();

        uVar3 = FUN_005df4c4();

        uVar4 = FUN_005df4c4();

        uVar7 = FUN_005df4c4();

        uVar7 = ((iVar2 << 8 | uVar3) << 8 | uVar4) << 8 | uVar7;

      }

      FUN_005a13a0((int)fVar9 + 0x22,fVar10,&DAT_008388d0,uVar7);

      if (DAT_00818c7c == 0) {

        sprintf(&DAT_008388d0,"Camera pos: <none>");

      }

      else {

        puVar5 = (undefined4 *)FUN_005aa9b0(local_8c);

        sprintf(&DAT_008388d0,"Camera pos: %s",*puVar5);

        puVar5 = (undefined4 *)((int)local_8c[0] + -0x14);

        LVar6 = InterlockedDecrement((LONG *)((int)local_8c[0] + -0x10));

        if ((LVar6 == 0) && (puVar5 != (undefined4 *)0x0)) {

          (**(code **)*puVar5)(1);

        }

      }

      FUN_005a13a0((int)fVar9 + 0x78,fVar10,&DAT_008388d0,

                   (-(uint)(uVar8 < 8) & 0xff553320) - 0x553320);

      uVar8 = uVar8 + 1;

    } while (uVar8 < 9);

    FUN_005a1390();

    FUN_005a4390(3 - (uint)(*(char *)(DAT_00870340 + 0xc4) != '\0'));

  }

  return;

}





// --- FUN_0043fcb0 at 0x0043FCB0 (size: 27) ---


void FUN_0043fcb0(void)



{

  FUN_0043ea20();

  return;

}





// --- FUN_0043fcd0 at 0x0043FCD0 (size: 243) ---


void FUN_0043fcd0(void)



{

  int iVar1;

  int iVar2;

  int iVar3;

  undefined4 uVar4;

  char unaff_BL;

  undefined4 unaff_EDI;

  int iVar5;

  undefined4 uVar6;

  

  if ((char)DAT_00870340[0x2b] != '\0') {

    iVar1 = DAT_00870340[0x24];

    iVar2 = DAT_00870340[0x23];

    iVar3 = *DAT_00870340;

    uVar6 = 0;

    uVar4 = FUN_0054fd30(0);

    uVar4 = FUN_0054fd20(uVar4);

    iVar5 = 0;

    (**(code **)(iVar3 + 0x40))(0,0,uVar4);

    if ((unaff_BL != '\0') && (DAT_00818c0c != '\0')) {

      FUN_004488a0();

      FUN_00557840();

    }

    if (DAT_0083846c != 0) {

      FUN_005da8f0();

    }

    if (DAT_00838468 != 0) {

      FUN_00692470();

    }

    FUN_0043f7f0();

    (**(code **)(*DAT_00870340 + 0x40))(iVar2,iVar1,unaff_EDI,uVar6,0);

    DAT_00870340[0x2a] = iVar5;

    (**(code **)(*DAT_00870340 + 0x24))();

    (**(code **)(*DAT_00870340 + 0x28))();

    FUN_0043e6b0();

    return;

  }

  return;

}





// --- FUN_0043fdd0 at 0x0043FDD0 (size: 457) ---


void FUN_0043fdd0(void)



{

  int iVar1;

  LONG LVar2;

  undefined4 *puVar3;

  int local_4;

  

  if (DAT_00838470 != '\0') {

    FUN_00401340("SceneTool.ScreenshotWidthScale");

    FUN_00436cf0(&local_4);

    puVar3 = (undefined4 *)(local_4 + -0x14);

    LVar2 = InterlockedDecrement((LONG *)(local_4 + -0x10));

    if ((LVar2 == 0) && (puVar3 != (undefined4 *)0x0)) {

      (**(code **)*puVar3)(1);

    }

    FUN_00401340("SceneTool.ScreenshotHeightScale");

    FUN_00436cf0(&local_4);

    puVar3 = (undefined4 *)(local_4 + -0x14);

    LVar2 = InterlockedDecrement((LONG *)(local_4 + -0x10));

    if ((LVar2 == 0) && (puVar3 != (undefined4 *)0x0)) {

      (**(code **)*puVar3)(1);

    }

    FUN_00401340("SceneTool.RenderUIObjects");

    FUN_00436cf0(&local_4);

    LVar2 = InterlockedDecrement((LONG *)(local_4 + -0x10));

    if ((LVar2 == 0) && ((undefined4 *)(local_4 + -0x14) != (undefined4 *)0x0)) {

      (*(code *)**(undefined4 **)(local_4 + -0x14))(1);

    }

    FUN_0054e370(FUN_004154a0);

    puVar3 = DAT_0083846c;

    if (DAT_0083846c != (undefined4 *)0x0) {

      iVar1 = DAT_0083846c[1];

      DAT_0083846c[1] = iVar1 + -1;

      if (iVar1 + -1 == 0) {

        (**(code **)*puVar3)(1);

      }

      DAT_0083846c = (undefined4 *)0x0;

    }

    puVar3 = DAT_00838468;

    if (DAT_00838468 != (undefined4 *)0x0) {

      iVar1 = DAT_00838468[1];

      DAT_00838468[1] = iVar1 + -1;

      if (iVar1 + -1 == 0) {

        (**(code **)*puVar3)(1);

      }

      DAT_00838468 = (undefined4 *)0x0;

    }

    puVar3 = DAT_0083845c;

    if (DAT_0083845c != (undefined4 *)0x0) {

      iVar1 = DAT_0083845c[1];

      DAT_0083845c[1] = iVar1 + -1;

      if (iVar1 + -1 == 0) {

        (**(code **)*puVar3)(1);

      }

      DAT_0083845c = (undefined4 *)0x0;

    }

    if (DAT_00838460 != (int *)0x0) {

      (**(code **)(*DAT_00838460 + 0x14))();

      DAT_00838460 = (int *)0x0;

    }

    if (DAT_00838464 != (int *)0x0) {

      (**(code **)(*DAT_00838464 + 0x14))();

      DAT_00838464 = (int *)0x0;

    }

    if (DAT_00838450 != (int *)0x0) {

      (**(code **)(*DAT_00838450 + 0x14))();

      DAT_00838450 = (int *)0x0;

    }

    if (DAT_00838454 != (int *)0x0) {

      (**(code **)(*DAT_00838454 + 0x14))();

      DAT_00838454 = (int *)0x0;

    }

    if (DAT_00838458 != (int *)0x0) {

      (**(code **)(*DAT_00838458 + 0x14))();

      DAT_00838458 = (int *)0x0;

    }

    if (DAT_00838430 != (int *)0x0) {

      (**(code **)(*DAT_00838430 + 0x14))();

      DAT_00838430 = (int *)0x0;

    }

    DAT_00838470 = '\0';

  }

  return;

}





// --- FUN_0043ffa0 at 0x0043FFA0 (size: 21) ---


void FUN_0043ffa0(undefined4 param_1)



{

  FUN_0044a770(&stack0x00000008,param_1);

  return;

}





// --- FUN_0043ffc0 at 0x0043FFC0 (size: 21) ---


void FUN_0043ffc0(undefined4 param_1)



{

  FUN_0044a770(&stack0x00000008,param_1);

  return;

}





// --- FUN_0043ffe0 at 0x0043FFE0 (size: 749) ---


undefined4 FUN_0043ffe0(void)



{

  int iVar1;

  int iVar2;

  int iStack_4;

  

  if (DAT_00838450 != (int *)0x0) {

    (**(code **)(*DAT_00838450 + 0x14))();

    DAT_00838450 = (int *)0x0;

  }

  if (DAT_00838454 != (int *)0x0) {

    (**(code **)(*DAT_00838454 + 0x14))();

    DAT_00838454 = (int *)0x0;

  }

  if (DAT_00838458 != (int *)0x0) {

    (**(code **)(*DAT_00838458 + 0x14))();

    DAT_00838458 = (int *)0x0;

  }

  iVar1 = FUN_005df0f5(0x4e0);

  if (iVar1 == 0) {

    DAT_00838450 = (int *)0x0;

  }

  else {

    DAT_00838450 = (int *)FUN_004497e0();

    if (DAT_00838450 != (int *)0x0) {

      iVar1 = FUN_005df0f5(0xd8);

      if (iVar1 != 0) {

        iVar1 = FUN_0044aa40();

        if (iVar1 != 0) {

          iVar2 = FUN_005df0f5(0x48);

          if (iVar2 != 0) {

            iStack_4 = FUN_00448350();

            if (iStack_4 != 0) {

              *(undefined4 *)(iStack_4 + 0x28) = 3;

              *(undefined4 *)(iStack_4 + 0x2c) = 2;

              *(undefined4 *)(iStack_4 + 0x30) = 3;

              *(undefined4 *)(iStack_4 + 0x34) = 3;

              *(undefined4 *)(iStack_4 + 0x38) = 2;

              *(undefined4 *)(iStack_4 + 0x3c) = 3;

              FUN_0044a770(&iStack_4,0);

              *(undefined4 *)(iVar1 + 0x34) = 5;

              *(undefined4 *)(iVar1 + 0x38) = 6;

              iStack_4 = iVar1;

              FUN_0044a770(&iStack_4,0);

              FUN_004494e0();

              iVar1 = FUN_005df0f5(0x4e0);

              if (iVar1 == 0) {

                DAT_00838454 = (int *)0x0;

                return 0;

              }

              DAT_00838454 = (int *)FUN_004497e0();

              if (DAT_00838454 != (int *)0x0) {

                iVar1 = FUN_005df0f5(0xd8);

                if (iVar1 != 0) {

                  iVar1 = FUN_0044aa40();

                  if (iVar1 != 0) {

                    iVar2 = FUN_005df0f5(0x48);

                    if (iVar2 != 0) {

                      iVar2 = FUN_00448350();

                      if (iVar2 != 0) {

                        iStack_4 = iVar2;

                        FUN_0044a770(&iStack_4,0);

                        iStack_4 = iVar1;

                        FUN_0044a770(&iStack_4,0);

                        *(undefined4 *)(iVar1 + 0x34) = 5;

                        *(undefined4 *)(iVar1 + 0x38) = 6;

                        FUN_0043dc50(&DAT_00818d08);

                        *(undefined4 *)(iVar2 + 0x28) = 3;

                        *(undefined4 *)(iVar2 + 0x2c) = 2;

                        *(undefined4 *)(iVar2 + 0x30) = 3;

                        *(undefined4 *)(iVar2 + 0x34) = 3;

                        *(undefined4 *)(iVar2 + 0x38) = 2;

                        *(undefined4 *)(iVar2 + 0x3c) = 3;

                        FUN_004494e0();

                        iVar1 = FUN_005df0f5(0x4e0);

                        if (iVar1 == 0) {

                          DAT_00838458 = (int *)0x0;

                          return 0;

                        }

                        DAT_00838458 = (int *)FUN_004497e0();

                        if (DAT_00838458 != (int *)0x0) {

                          iVar1 = FUN_005df0f5(0xd8);

                          if (iVar1 != 0) {

                            iVar1 = FUN_0044aa40();

                            if (iVar1 != 0) {

                              iVar2 = FUN_005df0f5(0x48);

                              if (iVar2 != 0) {

                                iVar2 = FUN_00448350();

                                if (iVar2 != 0) {

                                  iStack_4 = iVar2;

                                  FUN_0044a770(&iStack_4,0);

                                  iStack_4 = iVar1;

                                  FUN_0044a770(&iStack_4,0);

                                  *(undefined4 *)(iVar1 + 0x34) = 5;

                                  *(undefined4 *)(iVar1 + 0x38) = 6;

                                  FUN_0043dc50(&DAT_00818d08);

                                  *(undefined4 *)(iVar2 + 0x28) = 3;

                                  *(undefined4 *)(iVar2 + 0x2c) = 2;

                                  *(undefined4 *)(iVar2 + 0x30) = 3;

                                  *(undefined4 *)(iVar2 + 0x34) = 3;

                                  *(undefined4 *)(iVar2 + 0x38) = 2;

                                  *(undefined4 *)(iVar2 + 0x3c) = 3;

                                  FUN_004494e0();

                                  return 1;

                                }

                              }

                            }

                          }

                        }

                      }

                    }

                  }

                }

              }

            }

          }

        }

      }

    }

  }

  return 0;

}





