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

// --- FUN_005b0040 at 0x005B0040 (size: 30) ---


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



{

  FUN_005affe0();

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

    operator_delete(param_1);

  }

  return param_1;

}





// --- FUN_005b0060 at 0x005B0060 (size: 87) ---


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



{

  *param_1 = &PTR_FUN_007e7288;

  param_1[3] = &PTR_FUN_0079da04;

  FUN_0046c1f0(0x17);

  param_1[0x20] = &PTR_FUN_007cab80;

  param_1[3] = &PTR_FUN_007e7284;

  param_1[0x20] = &PTR_LAB_007e726c;

  if (param_1 != param_2) {

    param_1[1] = param_2[1];

    param_1[2] = param_2[2];

    FUN_005afbf0(param_2 + 3);

  }

  return param_1;

}





// --- FUN_005b01c0 at 0x005B01C0 (size: 87) ---


void __thiscall FUN_005b01c0(int param_1,undefined4 *param_2)



{

  uint uVar1;

  int *piVar2;

  undefined4 uVar3;

  int iVar4;

  uint uVar5;

  int *piVar6;

  

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

  uVar5 = 0;

  if (uVar1 != 0) {

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

    piVar6 = piVar2;

    do {

      if (*piVar6 != 0) {

        iVar4 = piVar2[uVar5];

        param_2[2] = piVar2;

        param_2[1] = iVar4;

        *param_2 = &PTR_LAB_007e729c;

        param_2[3] = uVar1;

        return;

      }

      uVar5 = uVar5 + 1;

      piVar6 = piVar6 + 1;

    } while (uVar5 < uVar1);

  }

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

  param_2[1] = 0;

  param_2[2] = uVar3;

  *param_2 = &PTR_LAB_007e729c;

  param_2[3] = uVar1;

  return;

}





// --- FUN_005b0220 at 0x005B0220 (size: 42) ---


void __fastcall FUN_005b0220(undefined4 *param_1)



{

  undefined4 *puVar1;

  LONG LVar2;

  

  puVar1 = (undefined4 *)param_1[2];

  LVar2 = InterlockedDecrement(puVar1 + 1);

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

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

  }

  *param_1 = &PTR_FUN_0079385c;

  return;

}





// --- FUN_005b02e0 at 0x005B02E0 (size: 62) ---


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



{

  undefined4 *puVar1;

  LONG LVar2;

  

  puVar1 = (undefined4 *)param_1[2];

  LVar2 = InterlockedDecrement(puVar1 + 1);

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

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

  }

  *param_1 = &PTR_FUN_0079385c;

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

    operator_delete(param_1);

  }

  return param_1;

}





// --- FUN_005b0320 at 0x005B0320 (size: 79) ---


int __thiscall FUN_005b0320(int param_1,int param_2)



{

  undefined4 *puVar1;

  int iVar2;

  LONG LVar3;

  

  if (param_1 != param_2) {

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

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

    if (puVar1 != *(undefined4 **)(param_2 + 8)) {

      LVar3 = InterlockedDecrement(puVar1 + 1);

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

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

      }

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

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

      InterlockedIncrement((LONG *)(iVar2 + 4));

    }

  }

  return param_1;

}





// --- FUN_005b0370 at 0x005B0370 (size: 71) ---


void __fastcall FUN_005b0370(int param_1)



{

  undefined4 *puVar1;

  LONG LVar2;

  LONG *lpAddend;

  

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

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

  if (puVar1 != DAT_008ef11c) {

    LVar2 = InterlockedDecrement(puVar1 + 1);

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

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

    }

    lpAddend = DAT_008ef11c + 1;

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

    InterlockedIncrement(lpAddend);

  }

  return;

}





// --- FUN_005b03e0 at 0x005B03E0 (size: 56) ---


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



{

  uint uVar1;

  

  uVar1 = (**(code **)(*param_1 + 8))();

  if (uVar1 <= param_3) {

    *(int *)*param_2 = param_1[1];

    *param_2 = *param_2 + 4;

    FUN_004fd290(param_2,param_3);

  }

  return uVar1;

}





// --- FUN_005b0420 at 0x005B0420 (size: 100) ---


undefined4 * __fastcall FUN_005b0420(undefined4 *param_1)



{

  undefined4 *puVar1;

  LONG LVar2;

  LONG *pLVar3;

  

  *param_1 = &PTR_FUN_007e72b4;

  pLVar3 = DAT_008ef11c + 1;

  param_1[2] = DAT_008ef11c;

  InterlockedIncrement(pLVar3);

  param_1[1] = 0;

  puVar1 = (undefined4 *)param_1[2];

  if (puVar1 != DAT_008ef11c) {

    LVar2 = InterlockedDecrement(puVar1 + 1);

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

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

    }

    pLVar3 = DAT_008ef11c + 1;

    param_1[2] = DAT_008ef11c;

    InterlockedIncrement(pLVar3);

  }

  return param_1;

}





// --- FUN_005b0490 at 0x005B0490 (size: 78) ---


bool __thiscall FUN_005b0490(int param_1,int *param_2,uint param_3)



{

  undefined4 *puVar1;

  uint uVar2;

  int iVar3;

  

  if (param_3 < 4) {

    return false;

  }

  FUN_005b0370();

  puVar1 = (undefined4 *)*param_2;

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

  iVar3 = *param_2;

  *param_2 = iVar3 + 4;

  uVar2 = (iVar3 + 4) - (int)puVar1;

  if (uVar2 < param_3) {

    iVar3 = param_3 - uVar2;

  }

  else {

    iVar3 = 0;

  }

  iVar3 = FUN_004fd460(param_2,iVar3);

  return iVar3 != 0;

}





// --- FUN_005b04e0 at 0x005B04E0 (size: 138) ---


void __fastcall FUN_005b04e0(int param_1)



{

  undefined4 *puVar1;

  void *pvVar2;

  void *pvVar3;

  LONG LVar4;

  uint local_4;

  

  if ((*(int *)(param_1 + 8) != 0) && (local_4 = 0, *(int *)(param_1 + 0xc) != 0)) {

    do {

      pvVar3 = *(void **)(*(int *)(param_1 + 8) + local_4 * 4);

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

        puVar1 = *(undefined4 **)((int)pvVar3 + 0xc);

        pvVar2 = *(void **)((int)pvVar3 + 0x10);

        LVar4 = InterlockedDecrement(puVar1 + 1);

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

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

        }

        *(undefined ***)((int)pvVar3 + 4) = &PTR_FUN_0079385c;

        operator_delete(pvVar3);

        pvVar3 = pvVar2;

      }

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

      local_4 = local_4 + 1;

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

  }

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

  return;

}





// --- FUN_005b0570 at 0x005B0570 (size: 81) ---


uint * __thiscall FUN_005b0570(uint *param_1,uint *param_2,undefined4 param_3,uint param_4)



{

  LONG *lpAddend;

  

  *param_1 = *param_2;

  param_1[1] = (uint)&PTR_FUN_007e72b4;

  lpAddend = (LONG *)(DAT_008ef11c + 4);

  param_1[3] = DAT_008ef11c;

  InterlockedIncrement(lpAddend);

  FUN_005b0320(param_3);

  param_1[4] = 0;

  param_1[5] = *param_2 % param_4;

  return param_1;

}





// --- FUN_005b05d0 at 0x005B05D0 (size: 284) ---


undefined4 __thiscall FUN_005b05d0(int param_1,undefined4 *param_2)



{

  undefined4 *puVar1;

  int *piVar2;

  LONG LVar3;

  undefined4 **ppuVar4;

  int iVar5;

  undefined4 *local_8;

  undefined4 *local_4;

  

  iVar5 = param_1 + 8;

  ppuVar4 = &local_8;

  FUN_0048c3e0(&DAT_00795338);

  piVar2 = (int *)FUN_004a2b90(ppuVar4,iVar5);

  puVar1 = (undefined4 *)*piVar2;

  if ((puVar1[2] != 1) && (puVar1 != DAT_008ef11c)) {

    FUN_004910c0(puVar1 + 5,puVar1[2] + -1);

  }

  LVar3 = InterlockedDecrement(local_8 + 1);

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

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

  }

  LVar3 = InterlockedDecrement(local_4 + 1);

  if ((LVar3 == 0) && (local_4 != (undefined4 *)0x0)) {

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

  }

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

    FUN_0048c3e0(&DAT_007e72c8);

    if ((param_2[2] != 1) && (param_2 != DAT_008ef11c)) {

      FUN_004910c0(param_2 + 5,param_2[2] + -1);

    }

    LVar3 = InterlockedDecrement(param_2 + 1);

    if (LVar3 == 0) {

      (**(code **)*param_2)(1);

    }

  }

  FUN_0048c3e0(&DAT_00795508);

  if ((param_2[2] != 1) && (param_2 != DAT_008ef11c)) {

    FUN_004910c0(param_2 + 5,param_2[2] + -1);

  }

  LVar3 = InterlockedDecrement(param_2 + 1);

  if (LVar3 == 0) {

    (**(code **)*param_2)(1);

  }

  return 1;

}





// --- FUN_005b06f0 at 0x005B06F0 (size: 892) ---


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



{

  uint uVar1;

  undefined4 *puVar2;

  LONG LVar3;

  int iVar4;

  code *pcVar5;

  undefined4 *puVar6;

  undefined4 *local_14;

  undefined1 local_10 [4];

  int iStack_c;

  int iStack_8;

  uint uStack_4;

  

  FUN_0048c3e0("Guests:\n");

  if ((local_14[2] != 1) && (local_14 != DAT_008ef11c)) {

    FUN_004910c0(local_14 + 5,local_14[2] + -1);

  }

  pcVar5 = InterlockedDecrement_exref;

  LVar3 = InterlockedDecrement(local_14 + 1);

  if (LVar3 == 0) {

    (**(code **)*local_14)(1);

  }

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

    FUN_0048c3e0("  None\n");

    if ((param_2[2] != 1) && (param_2 != DAT_008ef11c)) {

      FUN_004910c0(param_2 + 5,param_2[2] + -1);

    }

    LVar3 = InterlockedDecrement(param_2 + 1);

    if (LVar3 == 0) {

      (**(code **)*param_2)(1);

    }

  }

  else {

    FUN_005b01c0(local_10);

LAB_005b0768:

    iVar4 = iStack_c;

    pcVar5 = InterlockedDecrement_exref;

    if (iVar4 != 0) {

      FUN_005b05d0(param_2);

      iStack_c = *(int *)(iVar4 + 0x10);

      if (*(int *)(iVar4 + 0x10) == 0) {

        uVar1 = *(uint *)(iVar4 + 0x14);

        do {

          uVar1 = uVar1 + 1;

          if (uStack_4 <= uVar1) {

            iStack_c = 0;

            goto LAB_005b0768;

          }

        } while (*(int *)(iStack_8 + uVar1 * 4) == 0);

        iStack_c = *(int *)(iStack_8 + uVar1 * 4);

      }

      goto LAB_005b0768;

    }

  }

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

    FUN_0048c3e0("Roommates:\n");

    puVar6 = param_3;

    if ((param_3[2] != 1) && (param_3 != DAT_008ef11c)) {

      FUN_004910c0(param_3 + 5,param_3[2] + -1);

    }

    iVar4 = (*pcVar5)(puVar6 + 1);

    if (iVar4 == 0) {

      (**(code **)*puVar6)(1);

    }

    puVar6 = *(undefined4 **)(param_1 + 0x24);

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

      FUN_0048c3e0("  None\n");

      puVar6 = param_3;

      if ((param_3[2] != 1) && (param_3 != DAT_008ef11c)) {

        FUN_004910c0(param_3 + 5,param_3[2] + -1);

      }

      iVar4 = (*pcVar5)(puVar6 + 1);

      if (iVar4 == 0) {

        (**(code **)*puVar6)(1);

      }

    }

    else {

      for (; pcVar5 = InterlockedDecrement_exref, puVar6 != (undefined4 *)0x0;

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

        param_3 = DAT_008ef11c;

        InterlockedIncrement(DAT_008ef11c + 1);

        FUN_00487620(&param_3,"  0x%08X\n",*puVar6);

        puVar2 = param_3;

        if ((param_3[2] != 1) && (param_3 != DAT_008ef11c)) {

          FUN_004910c0(param_3 + 5,param_3[2] + -1);

        }

        LVar3 = InterlockedDecrement(puVar2 + 1);

        if (LVar3 == 0) {

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

        }

      }

    }

  }

  if ((*(byte *)(param_1 + 4) & 6) != 0) {

    FUN_0048c3e0("Allegiance Permissions: ");

    puVar6 = param_3;

    if ((param_3[2] != 1) && (param_3 != DAT_008ef11c)) {

      FUN_004910c0(param_3 + 5,param_3[2] + -1);

    }

    iVar4 = (*pcVar5)(puVar6 + 1);

    if (iVar4 == 0) {

      (**(code **)*puVar6)(1);

    }

    if ((*(byte *)(param_1 + 4) & 2) != 0) {

      FUN_0048c3e0("guest access");

      if ((param_2[2] != 1) && (param_2 != DAT_008ef11c)) {

        FUN_004910c0(param_2 + 5,param_2[2] + -1);

      }

      iVar4 = (*pcVar5)(param_2 + 1);

      if (iVar4 == 0) {

        (**(code **)*param_2)(1);

      }

    }

    if ((*(byte *)(param_1 + 4) & 4) != 0) {

      FUN_0048c3e0("storage access");

      if ((param_2[2] != 1) && (param_2 != DAT_008ef11c)) {

        FUN_004910c0(param_2 + 5,param_2[2] + -1);

      }

      iVar4 = (*pcVar5)(param_2 + 1);

      if (iVar4 == 0) {

        (**(code **)*param_2)(1);

      }

    }

    FUN_0048c3e0(&DAT_00795508);

    if ((param_2[2] != 1) && (param_2 != DAT_008ef11c)) {

      FUN_004910c0(param_2 + 5,param_2[2] + -1);

    }

    iVar4 = (*pcVar5)(param_2 + 1);

    if (iVar4 == 0) {

      (**(code **)*param_2)(1);

    }

  }

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

    FUN_0048c3e0("[ open house ]\n");

    puVar6 = param_3;

    if ((param_3[2] != 1) && (param_3 != DAT_008ef11c)) {

      FUN_004910c0(param_3 + 5,param_3[2] + -1);

    }

    iVar4 = (*pcVar5)(puVar6 + 1);

    if (iVar4 == 0) {

      (**(code **)*puVar6)(1);

    }

  }

  return 1;

}





// --- FUN_005b0a70 at 0x005B0A70 (size: 322) ---


bool __thiscall FUN_005b0a70(int param_1,int *param_2,uint param_3)



{

  uint *puVar1;

  uint uVar2;

  uint uVar3;

  uint uVar4;

  undefined4 uVar5;

  int iVar6;

  uint unaff_retaddr;

  

  uVar2 = param_3;

  if (param_3 < 4) {

    return false;

  }

  puVar1 = (uint *)*param_2;

  uVar4 = *puVar1;

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

  if ((uVar4 & 0xffff0000) == 0) {

    param_3 = 0;

    uVar3 = 4;

  }

  else {

    param_3 = uVar4;

    if (uVar4 == 0) {

      uVar3 = 4;

    }

    else {

      uVar3 = 0xc;

    }

  }

  if (uVar3 <= uVar2) {

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

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

    FUN_005b04e0();

    FUN_0049f850();

    if (param_3 == 0) {

      if (uVar4 == 0) {

        uVar4 = *(uint *)(param_1 + 4) & 0xfffffffe;

      }

      else {

        uVar4 = *(uint *)(param_1 + 4) | 1;

      }

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

      if ((uint)(*param_2 - (int)puVar1) < uVar2) {

        iVar6 = uVar2 - (*param_2 - (int)puVar1);

      }

      else {

        iVar6 = 0;

      }

      iVar6 = (**(code **)(*(int *)(param_1 + 0xc) + 0x10))(param_2,iVar6);

      return iVar6 != 0;

    }

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

    iVar6 = *param_2;

    *param_2 = iVar6 + 4;

    *(undefined4 *)(param_1 + 8) = *(undefined4 *)(iVar6 + 4);

    iVar6 = *param_2;

    *param_2 = iVar6 + 4;

    uVar4 = (iVar6 + 4) - (int)puVar1;

    if (uVar4 < uVar2) {

      iVar6 = uVar2 - uVar4;

    }

    else {

      iVar6 = 0;

    }

    iVar6 = (**(code **)(*(int *)(param_1 + 0xc) + 0x10))(param_2,iVar6);

    if (iVar6 != 0) {

      if (0x10000001 < unaff_retaddr) {

        uVar5 = FUN_00526d90(*param_2,puVar1,uVar2);

        iVar6 = (**(code **)(*(int *)(param_1 + 0x30) + 0x10))(param_2,uVar5);

        if (iVar6 == 0) {

          return false;

        }

      }

      FUN_004fd1b0(param_2);

      return true;

    }

  }

  return false;

}





// --- FUN_005b0bc0 at 0x005B0BC0 (size: 141) ---


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



{

  uint *puVar1;

  int iVar2;

  

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

    for (puVar1 = *(uint **)(*(int *)(param_1 + 8) + (*param_2 % *(uint *)(param_1 + 0xc)) * 4);

        puVar1 != (uint *)0x0; puVar1 = (uint *)puVar1[4]) {

      if (*param_2 == *puVar1) {

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

          return 0;

        }

        break;

      }

    }

  }

  iVar2 = FUN_005df0f5(0x18);

  if ((iVar2 != 0) &&

     (iVar2 = FUN_005b0570(param_2,param_3,*(undefined4 *)(param_1 + 0xc)), iVar2 != 0)) {

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

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

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

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

    return 1;

  }

  return 0;

}





// --- FUN_005b0da0 at 0x005B0DA0 (size: 72) ---


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



{

  *param_1 = &PTR_FUN_007e72a0;

  FUN_005b04e0();

  if ((void *)param_1[2] != (void *)0x0) {

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

    param_1[2] = 0;

  }

  param_1[3] = 0;

  *param_1 = &PTR_FUN_0079385c;

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

    operator_delete(param_1);

  }

  return param_1;

}





// --- FUN_005b0df0 at 0x005B0DF0 (size: 105) ---


undefined4 * __fastcall FUN_005b0df0(undefined4 *param_1)



{

  *param_1 = &PTR_FUN_007e7344;

  param_1[3] = &PTR_FUN_007e72a0;

  param_1[4] = 0;

  param_1[5] = 0;

  param_1[6] = 0x80;

  param_1[7] = 0;

  FUN_005a8440();

  param_1[9] = 0;

  param_1[10] = 0;

  param_1[0xb] = 0;

  param_1[0xc] = &PTR_FUN_0079385c;

  param_1[8] = &PTR_FUN_007a83d8;

  param_1[0xc] = &PTR_LAB_007a5164;

  param_1[1] = 0;

  param_1[2] = 0;

  FUN_005b04e0();

  FUN_0049f850();

  return param_1;

}





// --- FUN_005b0e60 at 0x005B0E60 (size: 119) ---


void __fastcall FUN_005b0e60(undefined4 *param_1)



{

  *param_1 = &PTR_FUN_007e7344;

  param_1[1] = 0;

  param_1[2] = 0;

  FUN_005b04e0();

  FUN_0049f850();

  param_1[0xc] = &PTR_LAB_007a5164;

  param_1[0xc] = &PTR_FUN_0079385c;

  param_1[8] = &PTR_FUN_007a5160;

  FUN_0049f850();

  param_1[3] = &PTR_FUN_007e72a0;

  FUN_005b04e0();

  if ((void *)param_1[5] != (void *)0x0) {

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

    param_1[5] = 0;

  }

  param_1[6] = 0;

  param_1[3] = &PTR_FUN_0079385c;

  *param_1 = &PTR_FUN_0079385c;

  return;

}





// --- FUN_005b0ee0 at 0x005B0EE0 (size: 30) ---


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



{

  FUN_005b0e60();

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

    operator_delete(param_1);

  }

  return param_1;

}





// --- FUN_005b0f00 at 0x005B0F00 (size: 44) ---


void __thiscall FUN_005b0f00(undefined4 *param_1,undefined4 param_2,undefined4 param_3)



{

  param_1[1] = param_2;

  *param_1 = 0;

  param_1[2] = param_3;

  param_1[3] = 0;

  param_1[4] = 0;

  param_1[5] = 0;

  param_1[6] = 0;

  param_1[7] = 0;

  param_1[8] = 0;

  param_1[9] = 0;

  return;

}





// --- FUN_005b0f30 at 0x005B0F30 (size: 184) ---


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



{

  undefined4 *puVar1;

  undefined4 *puVar2;

  undefined4 uVar3;

  LONG LVar4;

  int iVar5;

  

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

  *param_3 = 0;

  uVar3 = DAT_008379ac;

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

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

    if ((puVar1[1] == *(int *)(param_1 + 0xc)) || (puVar1[1] == *(int *)(param_1 + 0xc) + 1)) {

      *param_2 = puVar1[1];

      *param_3 = puVar1[2];

      puVar1[2] = 0;

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

      *(undefined4 *)(param_1 + 0xc) = puVar1[1];

      puVar2 = (undefined4 *)puVar1[2];

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

        LVar4 = InterlockedDecrement(puVar2 + 1);

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

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

        }

      }

      operator_delete(puVar1);

      if ((*(int *)(param_1 + 0x1c) != 0) &&

         (iVar5 = *(int *)(param_1 + 0x1c) + -1, *(int *)(param_1 + 0x1c) = iVar5, iVar5 < 0)) {

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

      }

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

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

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

      }

      return 1;

    }

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

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

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

    }

  }

  return 0;

}





// --- FUN_005b0ff0 at 0x005B0FF0 (size: 106) ---


void __fastcall FUN_005b0ff0(int param_1)



{

  int iVar1;

  undefined4 *puVar2;

  undefined4 *puVar3;

  LONG LVar4;

  

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

  while (iVar1 != 0) {

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

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

    puVar3 = (undefined4 *)puVar2[2];

    if (((puVar3 != (undefined4 *)0x0) && (LVar4 = InterlockedDecrement(puVar3 + 1), LVar4 == 0)) &&

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

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

    }

    operator_delete(puVar2);

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

  }

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

  if (((puVar2 != (undefined4 *)0x0) && (LVar4 = InterlockedDecrement(puVar2 + 1), LVar4 == 0)) &&

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

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

  }

  return;

}





// --- FUN_005b1060 at 0x005B1060 (size: 128) ---


undefined4 __thiscall

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



{

  uint uVar1;

  uint uVar2;

  int iVar3;

  

  *param_1 = 1;

  *param_4 = param_1[3];

  *param_5 = 0;

  uVar1 = param_1[3];

  if (param_2 != uVar1) {

    uVar2 = param_2 - uVar1;

    iVar3 = 1;

    if (param_2 < uVar1) {

      uVar2 = uVar1 - param_2;

      iVar3 = -1;

    }

    if (0x7ffffffe < uVar2) {

      iVar3 = -iVar3;

    }

    if (0 < iVar3) {

      param_1[3] = param_2;

      *param_4 = param_2;

      InterlockedIncrement((LONG *)(param_3 + 4));

      *param_5 = param_3;

      return 1;

    }

  }

  return 3;

}





// --- FUN_005b10e0 at 0x005B10E0 (size: 179) ---


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



{

  uint uVar1;

  uint uVar2;

  undefined4 *puVar3;

  uint uVar4;

  int iVar5;

  undefined4 *puVar6;

  undefined4 *puVar7;

  

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

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

    param_2 = (undefined4 *)0x0;

  }

  else {

    puVar3[1] = param_2;

    *puVar3 = 0;

    puVar3[2] = param_3;

    param_2 = puVar3;

    if (param_3 != 0) {

      InterlockedIncrement((LONG *)(param_3 + 4));

    }

  }

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

  puVar7 = (undefined4 *)*puVar3;

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

    uVar1 = param_2[1];

    puVar6 = puVar7;

    while (uVar2 = puVar6[1], puVar7 = puVar6, uVar1 != uVar2) {

      uVar4 = uVar1 - uVar2;

      iVar5 = 1;

      if (uVar1 < uVar2) {

        uVar4 = uVar2 - uVar1;

        iVar5 = -1;

      }

      if (0x7ffffffe < uVar4) {

        iVar5 = -iVar5;

      }

      if ((iVar5 < 1) ||

         (puVar7 = (undefined4 *)*puVar6, puVar3 = puVar6, puVar6 = puVar7,

         puVar7 == (undefined4 *)0x0)) break;

    }

  }

  *param_2 = puVar7;

  *puVar3 = param_2;

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

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

  }

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

  return;

}





// --- FUN_005b11a0 at 0x005B11A0 (size: 303) ---


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



int __thiscall FUN_005b11a0(int *param_1,uint param_2,int param_3,uint *param_4,int *param_5)



{

  uint uVar1;

  int iVar2;

  uint *puVar3;

  int *piVar4;

  int iVar5;

  

  piVar4 = param_5;

  puVar3 = param_4;

  iVar5 = param_3;

  *param_4 = param_1[3];

  *param_5 = 0;

  if (*param_1 == 0) {

    *param_1 = 1;

  }

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

    return 3;

  }

  uVar1 = param_1[3];

  if ((param_2 == uVar1) || (param_2 == uVar1 + 1)) {

    param_1[3] = param_2;

    *param_4 = param_2;

    if (param_3 != 0) {

      InterlockedIncrement((LONG *)(param_3 + 4));

    }

    *piVar4 = iVar5;

    return 1;

  }

  *param_4 = uVar1;

  *param_5 = 0;

  iVar5 = param_1[7];

  param_4 = (uint *)0x0;

  FUN_005b10e0(param_2,param_3,&param_4);

  iVar2 = DAT_008379ac;

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

    return 3;

  }

  if ((iVar5 == 0) && (param_1[7] == 1)) {

    param_1[8] = DAT_008379a8;

    param_1[9] = iVar2;

  }

  if (((0x13 < param_1[7]) && (*(double *)(param_1 + 8) != _DAT_00795610)) &&

     (_DAT_007ae018 < (double)CONCAT44(DAT_008379ac,DAT_008379a8) - *(double *)(param_1 + 8))) {

    param_4 = (uint *)0x0;

    param_3 = 0;

    FUN_005b11a0(param_1[3] + 1,0,&param_4,&param_3);

    iVar5 = FUN_005b0f30(puVar3,piVar4);

    return 2 - (uint)(iVar5 != 0);

  }

  return 2;

}





// --- FUN_005b12d0 at 0x005B12D0 (size: 44) ---


undefined4 __thiscall FUN_005b12d0(int param_1)



{

  undefined4 uVar1;

  undefined4 *in_stack_00000010;

  

  *in_stack_00000010 = 0;

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

    uVar1 = FUN_005b11a0();

    return uVar1;

  }

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

    return 0;

  }

  uVar1 = FUN_005b1060();

  return uVar1;

}





// --- FUN_005b1300 at 0x005B1300 (size: 35) ---


undefined4 FUN_005b1300(undefined4 param_1,undefined4 param_2)



{

  FUN_005b1970(param_1);

  FUN_005b1970(param_2);

  return 1;

}





// --- FUN_005b1330 at 0x005B1330 (size: 86) ---


void __thiscall FUN_005b1330(int *param_1,uint param_2)



{

  int iVar1;

  uint uVar2;

  

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

    iVar1 = thunk_FUN_005df0f5(param_2 * 4);

    uVar2 = 0;

    if (param_1[2] != 0) {

      do {

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

        uVar2 = uVar2 + 1;

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

    }

    operator_delete__((void *)*param_1);

    *param_1 = iVar1;

    param_1[1] = param_2;

  }

  return;

}





// --- FUN_005b1390 at 0x005B1390 (size: 125) ---


void __thiscall FUN_005b1390(int *param_1,uint param_2,int param_3)



{

  int iVar1;

  uint uVar2;

  

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

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

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

      while (*(int *)(*param_1 + -4 + param_1[2] * 4) == 0) {

        iVar1 = param_1[2] + -1;

        param_1[2] = iVar1;

        if (iVar1 == 0) {

          return;

        }

      }

    }

  }

  else if (param_3 != 0) {

    FUN_005b1330(param_2 + 1);

    for (uVar2 = param_1[2]; uVar2 < param_2; uVar2 = uVar2 + 1) {

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

    }

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

    param_1[2] = param_2 + 1;

  }

  return;

}





// --- FUN_005b1410 at 0x005B1410 (size: 58) ---


uint FUN_005b1410(int param_1,uint param_2,uint *param_3,uint *param_4)



{

  uint uVar1;

  uint uVar2;

  uint uVar3;

  uint uVar4;

  uint local_8;

  

  local_8 = 0;

  do {

    uVar2 = *param_4;

    uVar3 = (uint)((ulonglong)uVar2 * (ulonglong)param_2);

    param_4 = param_4 + 1;

    uVar4 = uVar3 + local_8;

    uVar1 = *param_3;

    *param_3 = *param_3 + uVar4;

    local_8 = (int)((ulonglong)uVar2 * (ulonglong)param_2 >> 0x20) + (uint)CARRY4(uVar3,local_8) +

              (uint)CARRY4(uVar1,uVar4);

    param_3 = param_3 + 1;

    param_1 = param_1 + -1;

  } while (param_1 != 0);

  return local_8;

}





// --- FUN_005b1450 at 0x005B1450 (size: 250) ---


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



{

  uint uVar1;

  uint uVar2;

  int *piVar3;

  uint uVar4;

  uint uVar5;

  uint uVar6;

  

  uVar6 = param_4 + 0x1f >> 5;

  FUN_005b1330(uVar6);

  uVar1 = 0;

  if (uVar6 != 0) {

    do {

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

      uVar1 = uVar1 + 1;

    } while (uVar1 < uVar6);

  }

  uVar1 = param_2[2];

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

    uVar1 = uVar6;

  }

  uVar4 = 0;

  if (uVar1 != 0) {

    do {

      uVar5 = param_3[2] + uVar4;

      if (uVar6 < param_3[2] + uVar4) {

        uVar5 = uVar6;

      }

      uVar2 = FUN_005b1410(uVar5 - uVar4,*(undefined4 *)(uVar4 * 4 + *param_2),*param_1 + uVar4 * 4,

                           *param_3);

      for (; (uVar2 != 0 && (uVar5 < uVar6)); uVar5 = uVar5 + 1) {

        *(uint *)(*param_1 + uVar5 * 4) = *(int *)(*param_1 + uVar5 * 4) + uVar2;

        uVar2 = (uint)(*(uint *)(*param_1 + uVar5 * 4) < uVar2);

      }

      uVar4 = uVar4 + 1;

    } while (uVar4 < uVar1);

  }

  if ((param_4 & 0x1f) != 0) {

    *(uint *)(*param_1 + -4 + uVar6 * 4) =

         *(uint *)(*param_1 + -4 + uVar6 * 4) & (1 << (sbyte)(param_4 & 0x1f)) - 1U;

  }

  if (uVar6 != 0) {

    piVar3 = (int *)(*param_1 + -4 + uVar6 * 4);

    do {

      if (*piVar3 != 0) break;

      uVar6 = uVar6 - 1;

      piVar3 = piVar3 + -1;

    } while (uVar6 != 0);

  }

  param_1[2] = uVar6;

  return;

}





// --- FUN_005b1550 at 0x005B1550 (size: 67) ---


int __fastcall FUN_005b1550(int *param_1)



{

  uint uVar1;

  int iVar2;

  uint uVar3;

  

  uVar3 = param_1[2];

  iVar2 = 0;

  if (uVar3 != 0) {

    uVar1 = uVar3 - 1;

    if (uVar1 < uVar3) {

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

    }

    else {

      uVar3 = 0;

    }

    iVar2 = uVar1 * 0x20;

    uVar1 = 0x20;

    do {

      uVar1 = uVar1 >> 1;

      if ((uint)(1 << (sbyte)uVar1) <= uVar3) {

        iVar2 = iVar2 + uVar1;

        uVar3 = uVar3 >> (sbyte)uVar1;

      }

    } while (8 < uVar1);

    iVar2 = iVar2 + (uint)(byte)(&DAT_00822370)[uVar3];

  }

  return iVar2;

}





// --- FUN_005b15a0 at 0x005B15A0 (size: 138) ---


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



{

  uint uVar1;

  uint uVar2;

  uint uVar3;

  uint uVar4;

  uint uVar5;

  

  uVar1 = param_2[2];

  uVar2 = param_1[2];

  if (uVar1 < uVar2) {

    return 1;

  }

  uVar3 = uVar2;

  if (uVar1 <= uVar2) {

    while( true ) {

      if (uVar3 == 0) {

        return 0;

      }

      uVar3 = uVar3 - 1;

      if (uVar3 < uVar2) {

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

      }

      else {

        uVar5 = 0;

      }

      if (uVar3 < uVar1) {

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

      }

      else {

        uVar4 = 0;

      }

      if (uVar4 < uVar5) break;

      if (uVar3 < uVar2) {

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

      }

      else {

        uVar5 = 0;

      }

      if ((uVar3 < uVar1) && (uVar5 < *(uint *)(*param_2 + uVar3 * 4))) {

        return 0xffffffff;

      }

    }

    return 1;

  }

  return 0xffffffff;

}





// --- FUN_005b1630 at 0x005B1630 (size: 112) ---


void __thiscall FUN_005b1630(int *param_1,int *param_2)



{

  int iVar1;

  uint uVar2;

  uint uVar3;

  uint uVar4;

  uint uVar5;

  uint uVar6;

  

  uVar4 = 0;

  uVar5 = param_1[2];

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

    uVar5 = param_2[2];

  }

  FUN_005b1330(uVar5);

  uVar6 = 0;

  if (uVar5 != 0xffffffff) {

    do {

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

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

      }

      else {

        iVar1 = 0;

      }

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

        uVar3 = *(uint *)(*param_2 + uVar6 * 4);

      }

      else {

        uVar3 = 0;

      }

      uVar2 = iVar1 + uVar4 + uVar3;

      uVar4 = (uint)(iVar1 + uVar4 < uVar4) + (uint)(uVar2 < uVar3);

      FUN_005b1390(uVar6,uVar2);

      uVar6 = uVar6 + 1;

    } while (uVar6 < uVar5 + 1);

  }

  return;

}





// --- FUN_005b16a0 at 0x005B16A0 (size: 86) ---


void __thiscall FUN_005b16a0(int *param_1,int *param_2)



{

  uint uVar1;

  uint uVar2;

  uint uVar3;

  int iVar4;

  uint uVar5;

  uint uVar6;

  

  uVar1 = param_1[2];

  uVar5 = 0;

  uVar6 = 0;

  if (uVar1 != 0) {

    do {

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

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

      }

      else {

        iVar4 = 0;

      }

      if (uVar5 <= iVar4 + uVar5) {

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

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

        }

        else {

          uVar3 = 0;

        }

        uVar2 = uVar3 - (iVar4 + uVar5);

        uVar5 = (uint)(uVar3 < uVar2);

        FUN_005b1390(uVar6,uVar2);

      }

      uVar6 = uVar6 + 1;

    } while (uVar6 < uVar1);

  }

  return;

}





// --- FUN_005b1700 at 0x005B1700 (size: 59) ---


void __thiscall FUN_005b1700(int param_1,int *param_2)



{

  undefined4 uVar1;

  uint uVar2;

  

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

  uVar2 = param_2[2];

  while (uVar2 != 0) {

    uVar2 = uVar2 - 1;

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

      uVar1 = *(undefined4 *)(*param_2 + uVar2 * 4);

    }

    else {

      uVar1 = 0;

    }

    FUN_005b1390(uVar2,uVar1);

  }

  return;

}





// --- FUN_005b1740 at 0x005B1740 (size: 46) ---


void __thiscall FUN_005b1740(int param_1,int param_2,uint param_3)



{

  uint uVar1;

  undefined4 uVar2;

  

  uVar1 = 0;

  if (param_3 != 0) {

    do {

      if (uVar1 < (uint)(*(int **)(param_1 + 4))[2]) {

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

      }

      else {

        uVar2 = 0;

      }

      *(undefined4 *)(param_2 + uVar1 * 4) = uVar2;

      uVar1 = uVar1 + 1;

    } while (uVar1 < param_3);

  }

  return;

}





// --- FUN_005b1770 at 0x005B1770 (size: 64) ---


void __fastcall FUN_005b1770(int param_1)



{

  int iVar1;

  undefined4 *puVar2;

  undefined4 *puVar3;

  

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

  if (iVar1 != 0) {

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

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

    puVar3 = (undefined4 *)0x0;

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

      puVar2[1] = 0;

      *puVar2 = 0;

      puVar2[2] = 0;

      puVar2[3] = 0;

      puVar3 = puVar2;

    }

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

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

  }

  return;

}





// --- FUN_005b17b0 at 0x005B17B0 (size: 51) ---


bool __thiscall FUN_005b17b0(int param_1,uint param_2)



{

  uint uVar1;

  

  if (param_2 >> 5 < (uint)(*(int **)(param_1 + 4))[2]) {

    uVar1 = *(uint *)(**(int **)(param_1 + 4) + (param_2 >> 5) * 4);

  }

  else {

    uVar1 = 0;

  }

  return (1 << ((byte)param_2 & 0x1f) & uVar1) != 0;

}





// --- FUN_005b17f0 at 0x005B17F0 (size: 133) ---


void __thiscall FUN_005b17f0(int param_1,uint param_2)



{

  int iVar1;

  undefined4 *puVar2;

  uint uVar3;

  uint uVar4;

  

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

  if (iVar1 != 0) {

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

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

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

      puVar2 = (undefined4 *)0x0;

    }

    else {

      puVar2[1] = 0;

      *puVar2 = 0;

      puVar2[2] = 0;

      puVar2[3] = 0;

    }

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

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

  }

  uVar3 = param_2 >> 5;

  if (uVar3 < (uint)(*(int **)(param_1 + 4))[2]) {

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

  }

  else {

    uVar4 = 0;

  }

  FUN_005b1390(uVar3,1 << ((byte)param_2 & 0x1f) | uVar4);

  return;

}





// --- FUN_005b1890 at 0x005B1890 (size: 111) ---


void __thiscall FUN_005b1890(int param_1,int param_2,uint param_3)



{

  int iVar1;

  undefined4 *puVar2;

  uint uVar3;

  

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

  uVar3 = 0;

  if (iVar1 != 0) {

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

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

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

      puVar2 = (undefined4 *)0x0;

    }

    else {

      puVar2[1] = 0;

      *puVar2 = 0;

      puVar2[2] = 0;

      puVar2[3] = 0;

    }

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

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

  }

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

  if (param_3 != 0) {

    do {

      FUN_005b1390(uVar3,*(undefined4 *)(param_2 + uVar3 * 4));

      uVar3 = uVar3 + 1;

    } while (uVar3 < param_3);

  }

  return;

}





// --- FUN_005b1900 at 0x005B1900 (size: 68) ---


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



{

  undefined4 *puVar1;

  

  *param_1 = &PTR_FUN_007e7358;

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

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

    puVar1 = (undefined4 *)0x0;

  }

  else {

    puVar1[1] = 0;

    *puVar1 = 0;

    puVar1[2] = 0;

    puVar1[3] = 0;

  }

  param_1[2] = 0;

  param_1[1] = puVar1;

  puVar1[2] = 0;

  FUN_005b1390(0,param_2);

  return param_1;

}





// --- FUN_005b1950 at 0x005B1950 (size: 30) ---


void __thiscall FUN_005b1950(undefined4 *param_1,int param_2)



{

  int *piVar1;

  int iVar2;

  

  *param_1 = &PTR_FUN_007e7358;

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

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

  param_1[1] = iVar2;

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

  *piVar1 = *piVar1 + 1;

  return;

}





// --- FUN_005b1970 at 0x005B1970 (size: 87) ---


int __thiscall FUN_005b1970(int param_1,int param_2)



{

  int *piVar1;

  int iVar2;

  

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

  if (piVar1[3] == 0) {

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

      iVar2 = piVar1[1];

      while (iVar2 != 0) {

        iVar2 = iVar2 + -1;

        *(undefined4 *)(*piVar1 + iVar2 * 4) = 0;

      }

      operator_delete__((void *)*piVar1);

      operator_delete(piVar1);

    }

  }

  else {

    piVar1[3] = piVar1[3] + -1;

  }

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

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

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

  *piVar1 = *piVar1 + 1;

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

  return param_1;

}





// --- FUN_005b19d0 at 0x005B19D0 (size: 86) ---


void __fastcall FUN_005b19d0(undefined4 *param_1)



{

  int *piVar1;

  int iVar2;

  

  piVar1 = (int *)param_1[1];

  *param_1 = &PTR_FUN_007e7358;

  if (piVar1[3] != 0) {

    piVar1[3] = piVar1[3] + -1;

    *param_1 = &PTR_FUN_0079385c;

    return;

  }

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

    iVar2 = piVar1[1];

    while (iVar2 != 0) {

      iVar2 = iVar2 + -1;

      *(undefined4 *)(*piVar1 + iVar2 * 4) = 0;

    }

    operator_delete__((void *)*piVar1);

    operator_delete(piVar1);

  }

  *param_1 = &PTR_FUN_0079385c;

  return;

}





// --- FUN_005b1a30 at 0x005B1A30 (size: 213) ---


int __thiscall FUN_005b1a30(int param_1,int param_2)



{

  int iVar1;

  undefined4 *puVar2;

  int iVar3;

  int extraout_ECX;

  undefined4 *puVar4;

  undefined **local_c [2];

  int local_4;

  

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

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

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

    if (iVar1 != 0) {

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

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

      puVar4 = (undefined4 *)0x0;

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

        puVar2[1] = 0;

        *puVar2 = 0;

        puVar2[2] = 0;

        puVar2[3] = 0;

        puVar4 = puVar2;

      }

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

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

    }

    FUN_005b1630(*(undefined4 *)(param_2 + 4));

    return param_1;

  }

  iVar3 = FUN_005b15a0(*(undefined4 *)(param_2 + 4));

  if (-1 < iVar3) {

    FUN_005b1770();

    FUN_005b16a0(*(undefined4 *)(param_2 + 4));

    return param_1;

  }

  local_c[0] = &PTR_FUN_007e7358;

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

  local_4 = iVar1;

  FUN_005b1970(param_2);

  FUN_005b1a30(local_c);

  FUN_005b19d0();

  return param_1;

}





// --- FUN_005b1b10 at 0x005B1B10 (size: 163) ---


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



{

  undefined4 uVar1;

  undefined4 uVar2;

  undefined4 *puVar3;

  int iVar4;

  int iVar5;

  

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

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

    puVar3 = (undefined4 *)0x0;

  }

  else {

    puVar3[1] = 0;

    *puVar3 = 0;

    puVar3[2] = 0;

    puVar3[3] = 0;

  }

  puVar3[2] = 0;

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

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

  iVar4 = FUN_005b1550();

  iVar5 = FUN_005b1550();

  FUN_005b1450(uVar1,uVar2,iVar4 + iVar5);

  param_2[2] = *(uint *)(param_3 + 8) ^ *(uint *)(param_1 + 8);

  *param_2 = &PTR_FUN_007e7358;

  param_2[1] = puVar3;

  puVar3[3] = puVar3[3] + 1;

  FUN_005b19d0();

  return param_2;

}





// --- FUN_005b1bc0 at 0x005B1BC0 (size: 840) ---


undefined4 __thiscall FUN_005b1bc0(int param_1,char *param_2)



{

  char *pcVar1;

  int *piVar2;

  undefined4 uVar3;

  int *piVar4;

  int *piVar5;

  int iVar6;

  int iVar7;

  char local_4c [4];

  int local_48;

  undefined4 local_44;

  int *local_40;

  undefined **local_3c;

  int *local_38;

  undefined4 local_34;

  undefined **local_30;

  int *local_2c;

  undefined4 local_28;

  undefined **local_24;

  int *local_20;

  undefined4 local_1c;

  undefined **local_18;

  int *local_14;

  int *local_8;

  undefined4 local_4;

  

  local_3c = &PTR_FUN_007e7358;

  local_48 = param_1;

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

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

    local_38 = (int *)0x0;

  }

  else {

    local_38[1] = 0;

    *local_38 = 0;

    local_38[2] = 0;

    local_38[3] = 0;

  }

  local_38[2] = 0;

  local_34 = 0;

  FUN_005b1970(&local_3c);

  FUN_005b19d0();

  local_4c[1] = 0;

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

    local_28 = 0;

    local_1c = 0;

    do {

      local_30 = &PTR_FUN_007e7358;

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

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

        piVar5 = (int *)0x0;

      }

      else {

        piVar5[1] = 0;

        *piVar5 = 0;

        piVar5[2] = 0;

        piVar5[3] = 0;

      }

      piVar5[2] = 0;

      local_2c = piVar5;

      FUN_005b1330(1);

      *(undefined4 *)*piVar5 = 0x10;

      piVar5[2] = 1;

      iVar6 = FUN_005b1b10(&local_18,&local_30);

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

      if (piVar2[3] == 0) {

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

          iVar7 = piVar2[1];

          while (iVar7 != 0) {

            iVar7 = iVar7 + -1;

            *(undefined4 *)(*piVar2 + iVar7 * 4) = 0;

          }

          operator_delete__((void *)*piVar2);

          operator_delete(piVar2);

        }

      }

      else {

        piVar2[3] = piVar2[3] + -1;

      }

      piVar4 = local_14;

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

      *(int *)(local_48 + 4) = iVar7;

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

      *piVar2 = *piVar2 + 1;

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

      local_18 = &PTR_FUN_007e7358;

      if (local_14[3] == 0) {

        iVar6 = local_14[1];

        while (iVar6 != 0) {

          iVar6 = iVar6 + -1;

          *(undefined4 *)(*local_14 + iVar6 * 4) = 0;

        }

        operator_delete__((void *)*local_14);

        operator_delete(piVar4);

      }

      else {

        local_14[3] = local_14[3] + -1;

      }

      local_18 = &PTR_FUN_0079385c;

      if (piVar5[3] == 0) {

        iVar6 = piVar5[1];

        while (iVar6 != 0) {

          iVar6 = iVar6 + -1;

          *(undefined4 *)(*piVar5 + iVar6 * 4) = 0;

        }

        operator_delete__((void *)*piVar5);

        operator_delete(piVar5);

      }

      else {

        piVar5[3] = piVar5[3] + -1;

      }

      local_4c[0] = *param_2;

      local_30 = &PTR_FUN_0079385c;

      local_44 = 0;

      sscanf(local_4c,"%x",&local_44);

      uVar3 = local_44;

      local_24 = &PTR_FUN_007e7358;

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

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

        piVar5 = (int *)0x0;

      }

      else {

        piVar5[1] = 0;

        *piVar5 = 0;

        piVar5[2] = 0;

        piVar5[3] = 0;

      }

      piVar5[2] = 0;

      local_20 = piVar5;

      FUN_005b1390(0,uVar3);

      iVar7 = local_48;

      local_3c = &PTR_FUN_007e7358;

      local_34 = *(undefined4 *)(local_48 + 8);

      local_38 = *(int **)(local_48 + 4);

      local_38[3] = local_38[3] + 1;

      FUN_005b1a30(&local_24);

      piVar2 = local_38;

      local_4 = local_34;

      iVar6 = local_38[3];

      local_8 = local_38;

      local_40 = local_38 + 3;

      *local_40 = iVar6 + 1;

      local_3c = &PTR_FUN_007e7358;

      if (iVar6 + 1 == 0) {

        iVar6 = local_38[1];

        while (iVar6 != 0) {

          iVar6 = iVar6 + -1;

          *(undefined4 *)(*local_38 + iVar6 * 4) = 0;

        }

        operator_delete__((void *)*local_38);

        operator_delete(piVar2);

      }

      else {

        local_38[3] = local_38[3] + -1;

      }

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

      local_3c = &PTR_FUN_0079385c;

      if (piVar2[3] == 0) {

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

          iVar6 = piVar2[1];

          while (iVar6 != 0) {

            iVar6 = iVar6 + -1;

            *(undefined4 *)(*piVar2 + iVar6 * 4) = 0;

          }

          operator_delete__((void *)*piVar2);

          operator_delete(piVar2);

        }

      }

      else {

        piVar2[3] = piVar2[3] + -1;

      }

      piVar2 = local_8;

      *(int **)(iVar7 + 4) = local_8;

      *local_40 = *local_40 + 1;

      iVar6 = *local_40;

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

      if (iVar6 == 0) {

        iVar6 = local_8[1];

        while (iVar6 != 0) {

          iVar6 = iVar6 + -1;

          *(undefined4 *)(*local_8 + iVar6 * 4) = 0;

        }

        operator_delete__((void *)*local_8);

        operator_delete(piVar2);

      }

      else {

        *local_40 = *local_40 + -1;

      }

      if (piVar5[3] == 0) {

        iVar6 = piVar5[1];

        while (iVar6 != 0) {

          iVar6 = iVar6 + -1;

          *(undefined4 *)(*piVar5 + iVar6 * 4) = 0;

        }

        operator_delete__((void *)*piVar5);

        operator_delete(piVar5);

      }

      else {

        piVar5[3] = piVar5[3] + -1;

      }

      pcVar1 = param_2 + 1;

      param_2 = param_2 + 1;

      local_24 = &PTR_FUN_0079385c;

      param_1 = local_48;

    } while (*pcVar1 != '\0');

  }

  return 1;

}





// --- FUN_005b1f70 at 0x005B1F70 (size: 16) ---


undefined4 FUN_005b1f70(int *param_1,uint param_2)



{

  int *piVar1;

  int iVar2;

  

  if (param_2 < 4) {

    return 0;

  }

  iVar2 = *(int *)*param_1;

  piVar1 = (int *)*param_1 + 1;

  *param_1 = (int)piVar1;

  if (param_2 - 4 < (uint)(iVar2 * 4)) {

    return 0;

  }

  FUN_005b1890(piVar1,iVar2);

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

  return 1;

}





// --- FUN_005b1f80 at 0x005B1F80 (size: 62) ---


undefined4 FUN_005b1f80(undefined4 param_1,int *param_2)



{

  int *piVar1;

  int iVar2;

  int unaff_EBP;

  

  iVar2 = *(int *)*param_2;

  piVar1 = (int *)*param_2 + 1;

  *param_2 = (int)piVar1;

  if (unaff_EBP - 4U < (uint)(iVar2 * 4)) {

    return 0;

  }

  FUN_005b1890(piVar1,iVar2);

  *param_2 = (int)(piVar1 + iVar2);

  return 1;

}





// --- FUN_005b1fc0 at 0x005B1FC0 (size: 30) ---


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



{

  FUN_005b19d0();

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

    operator_delete(param_1);

  }

  return param_1;

}





// --- FUN_005b1fe0 at 0x005B1FE0 (size: 44) ---


void __fastcall FUN_005b1fe0(undefined4 *param_1)



{

  *param_1 = 1;

  param_1[1] = 0;

  param_1[3] = 0x3f800000;

  param_1[5] = 0;

  param_1[7] = 0x3f800000;

  param_1[9] = 0;

  param_1[2] = 0;

  param_1[4] = 0;

  param_1[6] = 0;

  param_1[8] = 0;

  param_1[10] = 0;

  return;

}





// --- FUN_005b2010 at 0x005B2010 (size: 501) ---


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



float10 __thiscall FUN_005b2010(int *param_1,float param_2,double param_3)



{

  float fVar1;

  float fVar2;

  float fVar3;

  float fVar4;

  int iVar5;

  int iVar6;

  float10 fVar7;

  float10 fVar8;

  float10 extraout_ST0;

  float10 fVar9;

  float10 extraout_ST1;

  

  if (*param_1 == 1) {

    return (float10)(float)param_1[1];

  }

  fVar2 = (float)param_1[4] * (float)param_3 + (float)param_1[3];

  fVar4 = (float)param_1[6] * (float)param_3 + (param_2 + (float)param_1[5]) * (float)_DAT_007beea0;

  fVar3 = (float)param_1[8] * (float)param_3 + (float)param_1[7];

  fVar7 = (float10)(float)param_1[2] * (float10)param_3 + (float10)(float)param_1[1];

  fVar1 = (float)fVar7;

  switch(*param_1) {

  case 2:

    return (float10)fVar3 * (float10)param_3 + (float10)fVar4 + fVar7;

  case 3:

    fVar7 = (float10)FUN_0042c860(0xbf800000,0x3f800000);

    return fVar7 * (float10)fVar2 + (float10)fVar1;

  case 4:

    fVar9 = (float10)fsin((float10)fVar3 * (float10)param_3 + (float10)fVar4);

    return fVar9 * (float10)fVar2 + fVar7;

  case 5:

    fVar8 = (float10)fsin((float10)fVar3 * (float10)param_3 + (float10)fVar4);

    fVar9 = (float10)fVar2;

    if (fVar8 < (float10)DAT_00796344) {

      return -fVar9 + fVar7;

    }

    break;

  case 6:

    fVar9 = (float10)fsin((float10)fVar3 * (float10)param_3 + (float10)fVar4);

    return ABS(fVar9) * (float10)fVar2 + fVar7;

  case 7:

    fVar7 = (float10)FUN_005b3980((double)(fVar3 * (float)param_3 + fVar4));

    return fVar7 * (float10)fVar2 + (float10)fVar1;

  case 8:

    fVar7 = (float10)FUN_005b3a10((double)(fVar3 * (float)param_3 + fVar4),

                                  (double)(_DAT_007938b0 -

                                          ((float)param_1[10] * (float)param_3 + (float)param_1[9]))

                                  ,0,0x40000000,0,0x40180000);

    return fVar7 * (float10)fVar2 + (float10)fVar1;

  case 9:

    iVar5 = FUN_005df4c4();

    iVar6 = FUN_005df4c4();

    if (iVar5 < 1) {

      return extraout_ST0;

    }

    if (iVar6 < 1) {

      return extraout_ST0;

    }

    FUN_005df4c4();

    fVar7 = extraout_ST1;

    iVar5 = FUN_005df4c4();

    fVar9 = (float10)iVar5 * (float10)fVar4;

    break;

  default:

    goto switchD_005b2083_default;

  }

  fVar7 = fVar9 + fVar7;

switchD_005b2083_default:

  return fVar7;

}





// --- FUN_005b2230 at 0x005B2230 (size: 20) ---


void FUN_005b2230(undefined4 param_1,undefined4 param_2)



{

  FUN_005b2010(0,param_1,param_2);

  return;

}





// --- FUN_005b2250 at 0x005B2250 (size: 46) ---


void __fastcall FUN_005b2250(undefined4 *param_1)



{

  *param_1 = 1;

  param_1[1] = 0;

  param_1[3] = 0x3f800000;

  param_1[5] = 0;

  param_1[7] = 0x3f800000;

  param_1[9] = 0;

  param_1[2] = 0;

  param_1[4] = 0;

  param_1[6] = 0;

  param_1[8] = 0;

  param_1[10] = 0;

  return;

}





// --- FUN_005b2280 at 0x005B2280 (size: 52) ---


void __thiscall FUN_005b2280(undefined4 *param_1,undefined4 param_2)



{

  param_1[5] = 0;

  param_1[9] = 0;

  param_1[2] = 0;

  param_1[4] = 0;

  param_1[6] = 0;

  param_1[8] = 0;

  param_1[10] = 0;

  *param_1 = 1;

  param_1[3] = 0x3f800000;

  param_1[7] = 0x3f800000;

  param_1[1] = param_2;

  return;

}





// --- FUN_005b22c0 at 0x005B22C0 (size: 52) ---


void __thiscall FUN_005b22c0(undefined4 *param_1,int param_2)



{

  undefined4 *puVar1;

  int iVar2;

  

  puVar1 = (undefined4 *)FUN_0040acf0(0x2c);

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

    iVar2 = 0xb;

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

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

        *puVar1 = *param_1;

        param_1 = param_1 + 1;

        puVar1 = puVar1 + 1;

      }

      return;

    }

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

      *param_1 = *puVar1;

      puVar1 = puVar1 + 1;

      param_1 = param_1 + 1;

    }

  }

  return;

}





// --- FUN_005b2300 at 0x005B2300 (size: 1182) ---


undefined1 __thiscall FUN_005b2300(undefined4 *param_1,int param_2)



{

  undefined4 *puVar1;

  char cVar2;

  int iVar3;

  int iVar4;

  LONG LVar5;

  int iVar6;

  undefined4 extraout_ECX;

  undefined4 extraout_ECX_00;

  undefined4 extraout_ECX_01;

  undefined4 extraout_ECX_02;

  undefined4 extraout_ECX_03;

  undefined4 extraout_ECX_04;

  undefined4 extraout_ECX_05;

  undefined4 extraout_ECX_06;

  undefined4 extraout_ECX_07;

  undefined4 extraout_ECX_08;

  undefined4 extraout_ECX_09;

  undefined4 extraout_ECX_10;

  char *pcVar7;

  undefined4 uVar8;

  char *local_34;

  undefined4 *local_30;

  undefined4 *local_2c;

  undefined4 *local_28;

  undefined4 *local_24;

  undefined4 *local_20;

  undefined4 *local_1c;

  undefined4 *local_18;

  undefined4 *local_14;

  undefined4 *local_10;

  

  iVar6 = param_2;

  if (param_2 != 0) {

    param_1[3] = 0x3f800000;

    local_30 = param_1 + 3;

    param_1[5] = 0;

    local_2c = param_1 + 5;

    param_1[7] = 0x3f800000;

    local_28 = param_1 + 7;

    param_1[9] = 0;

    local_24 = param_1 + 9;

    local_20 = param_1 + 2;

    *local_20 = 0;

    local_1c = param_1 + 4;

    *local_1c = 0;

    local_18 = param_1 + 6;

    *local_18 = 0;

    local_14 = param_1 + 8;

    *local_14 = 0;

    local_10 = param_1 + 10;

    puVar1 = param_1 + 1;

    param_2._0_1_ = 1;

    *param_1 = 1;

    *puVar1 = 0;

    *local_10 = 0;

    FUN_0065cf90(iVar6);

    iVar3 = FUN_0065c810();

    if (iVar3 == 0) {

      *param_1 = 1;

      cVar2 = FUN_00426cb0(puVar1);

      if (cVar2 == '\0') {

        uVar8 = extraout_ECX;

        FUN_00401340("Error parsing waveform base value");

        FUN_0065d620(iVar6,uVar8);

        FUN_0065cae0();

        return 0;

      }

      FUN_0065cae0();

      return 1;

    }

    local_34 = PTR_DAT_00818344;

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

    FUN_00426020(&local_34);

    iVar4 = _stricmp(local_34,DAT_008ef150);

    if (iVar4 == 0) {

      *param_1 = 2;

    }

    else {

      iVar4 = _stricmp(local_34,DAT_008ef154);

      if (iVar4 == 0) {

        *param_1 = 3;

      }

      else {

        iVar4 = _stricmp(local_34,DAT_008ef158);

        if (iVar4 == 0) {

          *param_1 = 4;

        }

        else {

          iVar4 = _stricmp(local_34,DAT_008ef15c);

          if (iVar4 == 0) {

            *param_1 = 5;

          }

          else {

            iVar4 = _stricmp(local_34,DAT_008ef160);

            if (iVar4 == 0) {

              *param_1 = 6;

            }

            else {

              iVar4 = _stricmp(local_34,DAT_008ef164);

              if (iVar4 == 0) {

                *param_1 = 7;

              }

              else {

                iVar4 = _stricmp(local_34,DAT_008ef168);

                if (iVar4 == 0) {

                  *param_1 = 8;

                }

                else {

                  iVar4 = _stricmp(local_34,DAT_008ef16c);

                  if (iVar4 == 0) {

                    *param_1 = 9;

                  }

                  else {

                    uVar8 = extraout_ECX_00;

                    FUN_00401340("Unknown wave type");

                    FUN_0065d620(iVar6,uVar8);

                    *param_1 = 1;

                    param_2._0_1_ = 0;

                  }

                }

              }

            }

          }

        }

      }

    }

    cVar2 = FUN_00426cb0(puVar1);

    if (cVar2 == '\0') {

      uVar8 = extraout_ECX_01;

      FUN_00401340("Error parsing waveform base value");

      FUN_0065d620(iVar3,uVar8);

      pcVar7 = local_34 + -0x14;

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

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

        (*(code *)**(undefined4 **)pcVar7)(1);

      }

    }

    else {

      iVar6 = FUN_0065cb10();

      if (iVar6 == 0) goto LAB_005b277e;

      cVar2 = FUN_00426cb0(local_30);

      if (cVar2 == '\0') {

        pcVar7 = "Error parsing waveform amplitude value";

        uVar8 = extraout_ECX_02;

      }

      else {

        iVar6 = FUN_0065cb10();

        if (iVar6 == 0) goto LAB_005b277e;

        cVar2 = FUN_00426cb0(local_2c);

        if (cVar2 == '\0') {

          pcVar7 = "Error parsing waveform phase value";

          uVar8 = extraout_ECX_03;

        }

        else {

          iVar6 = FUN_0065cb10();

          if (iVar6 == 0) goto LAB_005b277e;

          cVar2 = FUN_00426cb0(local_28);

          if (cVar2 == '\0') {

            pcVar7 = "Error parsing waveform frequency value";

            uVar8 = extraout_ECX_04;

          }

          else {

            iVar6 = FUN_0065cb10();

            if (iVar6 == 0) goto LAB_005b277e;

            cVar2 = FUN_00426cb0(local_24);

            if (cVar2 == '\0') {

              pcVar7 = "Error parsing waveform roughness value";

              uVar8 = extraout_ECX_05;

            }

            else {

              iVar6 = FUN_0065cb10();

              if (iVar6 == 0) goto LAB_005b277e;

              cVar2 = FUN_00426cb0(local_20);

              if (cVar2 == '\0') {

                pcVar7 = "Error parsing waveform base velocity value";

                uVar8 = extraout_ECX_06;

              }

              else {

                iVar6 = FUN_0065cb10();

                if (iVar6 == 0) goto LAB_005b277e;

                cVar2 = FUN_00426cb0(local_1c);

                if (cVar2 == '\0') {

                  pcVar7 = "Error parsing waveform amplitude velocity value";

                  uVar8 = extraout_ECX_07;

                }

                else {

                  iVar6 = FUN_0065cb10();

                  if (iVar6 == 0) goto LAB_005b277e;

                  cVar2 = FUN_00426cb0(local_18);

                  if (cVar2 == '\0') {

                    pcVar7 = "Error parsing waveform phase velocity value";

                    uVar8 = extraout_ECX_08;

                  }

                  else {

                    iVar6 = FUN_0065cb10();

                    if (iVar6 == 0) goto LAB_005b277e;

                    cVar2 = FUN_00426cb0(local_14);

                    if (cVar2 == '\0') {

                      pcVar7 = "Error parsing waveform frequency velocity value";

                      uVar8 = extraout_ECX_09;

                    }

                    else {

                      iVar6 = FUN_0065cb10();

                      if (iVar6 == 0) {

LAB_005b277e:

                        FUN_004011b0();

                        FUN_0065cae0();

                        return (undefined1)param_2;

                      }

                      cVar2 = FUN_00426cb0(local_10);

                      if (cVar2 != '\0') goto LAB_005b277e;

                      pcVar7 = "Error parsing waveform roughness velocity value";

                      uVar8 = extraout_ECX_10;

                    }

                  }

                }

              }

            }

          }

        }

      }

      FUN_00401340(pcVar7);

      FUN_0065d620(iVar6,uVar8);

      FUN_004011b0();

    }

    FUN_0065cae0();

  }

  return 0;

}





// --- FUN_005b27a0 at 0x005B27A0 (size: 254) ---


void __thiscall FUN_005b27a0(int *param_1,int *param_2)



{

  int iVar1;

  LONG LVar2;

  

  iVar1 = *param_1;

  if (iVar1 == 1) {

    iVar1 = *param_2;

    if (iVar1 != DAT_008ef14c) {

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

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

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

      }

      *param_2 = DAT_008ef14c;

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

                    /* WARNING: Treating indirect jump as call */

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

      return;

    }

  }

  else {

    if (iVar1 == 2) {

      FUN_00402070(&DAT_008ef150);

      return;

    }

    if (iVar1 == 3) {

      FUN_00402070(&DAT_008ef154);

      return;

    }

    if (iVar1 == 4) {

      FUN_00402070(&DAT_008ef158);

      return;

    }

    if (iVar1 == 5) {

      FUN_00402070(&DAT_008ef15c);

      return;

    }

    if (iVar1 == 6) {

      FUN_00402070(&DAT_008ef160);

      return;

    }

    if (iVar1 == 7) {

      FUN_00402070(&DAT_008ef164);

      return;

    }

    if (iVar1 == 8) {

      FUN_00402070(&DAT_008ef168);

      return;

    }

    if (iVar1 == 9) {

      FUN_00402070(&DAT_008ef16c);

      return;

    }

    FUN_00405000("Unknown");

  }

  return;

}





// --- FUN_005b28a0 at 0x005B28A0 (size: 898) ---


void __thiscall FUN_005b28a0(int *param_1,int *param_2)



{

  LONG *lpAddend;

  int iVar1;

  undefined *puVar2;

  int *piVar3;

  undefined4 *puVar4;

  LONG LVar5;

  int iVar6;

  undefined *puVar7;

  

  piVar3 = (int *)(**(code **)(*param_2 + 4))();

  if (*param_1 != 1) {

    param_2 = (int *)PTR_DAT_00818344;

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

    FUN_005b27a0(&param_2);

    puVar2 = (undefined *)param_2;

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

    InterlockedIncrement(lpAddend);

    puVar7 = puVar2;

    InterlockedIncrement(lpAddend);

    FUN_00427050(puVar7);

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

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

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

    }

    iVar6 = (**(code **)(*piVar3 + 4))();

    iVar1 = param_1[1];

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

      (**(code **)**(undefined4 **)(iVar6 + 8))(1);

    }

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

    puVar4 = (undefined4 *)FUN_005df0f5(8);

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

      puVar4 = (undefined4 *)0x0;

    }

    else {

      *puVar4 = &PTR_FUN_007980d0;

      puVar4[1] = iVar1;

    }

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

    iVar6 = (**(code **)(*piVar3 + 4))();

    iVar1 = param_1[3];

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

      (**(code **)**(undefined4 **)(iVar6 + 8))(1);

    }

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

    puVar4 = (undefined4 *)FUN_005df0f5(8);

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

      puVar4 = (undefined4 *)0x0;

    }

    else {

      *puVar4 = &PTR_FUN_007980d0;

      puVar4[1] = iVar1;

    }

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

    iVar6 = (**(code **)(*piVar3 + 4))();

    iVar1 = param_1[5];

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

      (**(code **)**(undefined4 **)(iVar6 + 8))(1);

    }

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

    puVar4 = (undefined4 *)FUN_005df0f5(8);

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

      puVar4 = (undefined4 *)0x0;

    }

    else {

      *puVar4 = &PTR_FUN_007980d0;

      puVar4[1] = iVar1;

    }

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

    iVar6 = (**(code **)(*piVar3 + 4))();

    iVar1 = param_1[7];

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

      (**(code **)**(undefined4 **)(iVar6 + 8))(1);

    }

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

    puVar4 = (undefined4 *)FUN_005df0f5(8);

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

      puVar4 = (undefined4 *)0x0;

    }

    else {

      *puVar4 = &PTR_FUN_007980d0;

      puVar4[1] = iVar1;

    }

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

    iVar6 = (**(code **)(*piVar3 + 4))();

    iVar1 = param_1[9];

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

      (**(code **)**(undefined4 **)(iVar6 + 8))(1);

    }

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

    puVar4 = (undefined4 *)FUN_005df0f5(8);

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

      puVar4 = (undefined4 *)0x0;

    }

    else {

      *puVar4 = &PTR_FUN_007980d0;

      puVar4[1] = iVar1;

    }

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

    iVar6 = (**(code **)(*piVar3 + 4))();

    iVar1 = param_1[2];

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

      (**(code **)**(undefined4 **)(iVar6 + 8))(1);

    }

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

    puVar4 = (undefined4 *)FUN_005df0f5(8);

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

      puVar4 = (undefined4 *)0x0;

    }

    else {

      *puVar4 = &PTR_FUN_007980d0;

      puVar4[1] = iVar1;

    }

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

    iVar6 = (**(code **)(*piVar3 + 4))();

    iVar1 = param_1[4];

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

      (**(code **)**(undefined4 **)(iVar6 + 8))(1);

    }

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

    puVar4 = (undefined4 *)FUN_005df0f5(8);

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

      puVar4 = (undefined4 *)0x0;

    }

    else {

      *puVar4 = &PTR_FUN_007980d0;

      puVar4[1] = iVar1;

    }

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

    iVar6 = (**(code **)(*piVar3 + 4))();

    iVar1 = param_1[6];

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

      (**(code **)**(undefined4 **)(iVar6 + 8))(1);

    }

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

    puVar4 = (undefined4 *)FUN_005df0f5(8);

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

      puVar4 = (undefined4 *)0x0;

    }

    else {

      *puVar4 = &PTR_FUN_007980d0;

      puVar4[1] = iVar1;

    }

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

    iVar6 = (**(code **)(*piVar3 + 4))();

    iVar1 = param_1[8];

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

      (**(code **)**(undefined4 **)(iVar6 + 8))(1);

    }

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

    puVar4 = (undefined4 *)FUN_005df0f5(8);

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

      puVar4 = (undefined4 *)0x0;

    }

    else {

      *puVar4 = &PTR_FUN_007980d0;

      puVar4[1] = iVar1;

    }

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

    iVar6 = (**(code **)(*piVar3 + 4))();

    iVar1 = param_1[10];

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

      (**(code **)**(undefined4 **)(iVar6 + 8))(1);

    }

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

    puVar4 = (undefined4 *)FUN_005df0f5(8);

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

      puVar4 = (undefined4 *)0x0;

    }

    else {

      *puVar4 = &PTR_FUN_007980d0;

      puVar4[1] = iVar1;

    }

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

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

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

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

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

    }

    return;

  }

  iVar1 = param_1[1];

  if ((undefined4 *)piVar3[2] != (undefined4 *)0x0) {

    (*(code *)**(undefined4 **)piVar3[2])(1);

  }

  piVar3[2] = 0;

  puVar4 = (undefined4 *)FUN_005df0f5(8);

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

    *puVar4 = &PTR_FUN_007980d0;

    puVar4[1] = iVar1;

    piVar3[2] = (int)puVar4;

    return;

  }

  piVar3[2] = 0;

  return;

}





// --- FUN_005b2c30 at 0x005B2C30 (size: 278) ---


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



{

  LONG LVar1;

  int local_10;

  int local_c;

  

  FUN_00401340();

  if (*param_1 == 1) {

    FUN_00402710(&local_10,&DAT_0079854c,(double)(float)param_1[1]);

  }

  else if (*param_1 == 2) {

    FUN_00402710(&local_10,"[Speed] Base:%.3f, Velocity:%.3f",(double)(float)param_1[1],

                 (double)(float)param_1[7]);

  }

  else {

    FUN_00401340();

    FUN_005b27a0();

    FUN_00402710(&local_10,"[%s] Base:%.3f, Amp:%.3f, Phase:%.3f, Freq:%.3f",local_c,

                 (double)(float)param_1[1],(double)(float)param_1[3],(double)(float)param_1[5],

                 (double)(float)param_1[7]);

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

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

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

    }

  }

  *param_2 = local_10;

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

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

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

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

  }

  return param_2;

}





// --- FUN_005b2d50 at 0x005B2D50 (size: 55) ---


undefined4 FUN_005b2d50(float param_1)



{

  int iVar1;

  

  iVar1 = _isnan((double)param_1);

  if (iVar1 == 0) {

    iVar1 = _finite((double)param_1);

    if (iVar1 != 0) {

      return 1;

    }

  }

  return 0;

}





// --- FUN_005b2d90 at 0x005B2D90 (size: 139) ---


undefined4 FUN_005b2d90(float *param_1)



{

  float fVar1;

  char cVar2;

  int iVar3;

  

  fVar1 = *param_1;

  iVar3 = _isnan((double)fVar1);

  if (iVar3 == 0) {

    iVar3 = _finite((double)fVar1);

    if (iVar3 != 0) {

      fVar1 = param_1[1];

      iVar3 = _isnan((double)fVar1);

      if (iVar3 == 0) {

        iVar3 = _finite((double)fVar1);

        if (iVar3 != 0) {

          cVar2 = FUN_005b2d50();

          if (cVar2 != '\0') {

            return 1;

          }

        }

      }

    }

  }

  return 0;

}





// --- FUN_005b2e20 at 0x005B2E20 (size: 117) ---


void __thiscall FUN_005b2e20(float *param_1,float *param_2)



{

  if (*param_1 < *param_2) {

    *param_2 = *param_1;

  }

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

    param_2[1] = param_1[1];

  }

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

    param_2[2] = param_1[2];

  }

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

    param_2[3] = param_1[3];

  }

  if (param_2[4] < param_1[4]) {

    param_2[4] = param_1[4];

  }

  if (param_2[5] < param_1[5]) {

    param_2[5] = param_1[5];

  }

  return;

}





// --- FUN_005b2ea0 at 0x005B2EA0 (size: 100) ---


void __fastcall FUN_005b2ea0(undefined4 *param_1)



{

  *param_1 = 0x7f7fffff;

  param_1[1] = 0x7f7fffff;

  param_1[2] = 0x7f7fffff;

  param_1[3] = 0xff7fffff;

  param_1[4] = 0xff7fffff;

  param_1[5] = 0xff7fffff;

  return;

}





// --- FUN_005b2f10 at 0x005B2F10 (size: 700) ---


void __thiscall FUN_005b2f10(undefined4 *param_1,undefined4 *param_2,undefined4 param_3)



{

  undefined4 local_24;

  undefined4 local_20;

  undefined4 local_1c;

  undefined4 local_18;

  undefined4 local_14;

  undefined4 local_10;

  undefined4 local_c;

  undefined4 local_8;

  undefined4 local_4;

  

  local_24 = *param_2;

  local_1c = param_2[2];

  local_20 = param_2[1];

  FUN_00452830(&local_18,param_3,&local_24);

  local_24 = local_18;

  local_20 = local_14;

  local_1c = local_10;

  *param_1 = local_18;

  param_1[1] = local_14;

  param_1[2] = local_10;

  param_1[3] = local_18;

  param_1[4] = local_14;

  param_1[5] = local_10;

  local_18 = param_2[3];

  local_14 = param_2[4];

  local_10 = param_2[5];

  FUN_00452830(&local_c,param_3,&local_18);

  local_24 = local_c;

  local_20 = local_8;

  local_1c = local_4;

  FUN_00534e90(&local_24);

  local_c = param_2[3];

  local_10 = param_2[2];

  local_8 = param_2[4];

  local_4 = local_10;

  FUN_00452830(&local_18,param_3,&local_c);

  local_24 = local_18;

  local_1c = local_10;

  local_20 = local_14;

  FUN_00534e90(&local_24);

  local_c = param_2[3];

  local_10 = param_2[5];

  local_8 = param_2[1];

  local_4 = local_10;

  FUN_00452830(&local_18,param_3,&local_c);

  local_24 = local_18;

  local_20 = local_14;

  local_1c = local_10;

  FUN_00534e90(&local_24);

  local_c = *param_2;

  local_10 = param_2[5];

  local_8 = param_2[4];

  local_4 = local_10;

  FUN_00452830(&local_18,param_3,&local_c);

  local_24 = local_18;

  local_20 = local_14;

  local_1c = local_10;

  FUN_00534e90(&local_24);

  local_c = *param_2;

  local_10 = param_2[2];

  local_8 = param_2[4];

  local_4 = local_10;

  FUN_00452830(&local_18,param_3,&local_c);

  local_24 = local_18;

  local_20 = local_14;

  local_1c = local_10;

  FUN_00534e90(&local_24);

  local_c = param_2[3];

  local_10 = param_2[2];

  local_8 = param_2[1];

  local_4 = local_10;

  FUN_00452830(&local_18,param_3,&local_c);

  local_24 = local_18;

  local_20 = local_14;

  local_1c = local_10;

  FUN_00534e90(&local_24);

  local_c = *param_2;

  local_10 = param_2[5];

  local_8 = param_2[1];

  local_4 = local_10;

  FUN_00452830(&local_18,param_3,&local_c);

  local_24 = local_18;

  local_20 = local_14;

  local_1c = local_10;

  FUN_00534e90(&local_24);

  return;

}





// --- FUN_005b31d0 at 0x005B31D0 (size: 700) ---


void __thiscall FUN_005b31d0(undefined4 *param_1,undefined4 *param_2,undefined4 param_3)



{

  undefined4 local_24;

  undefined4 local_20;

  undefined4 local_1c;

  undefined4 local_18;

  undefined4 local_14;

  undefined4 local_10;

  undefined4 local_c;

  undefined4 local_8;

  undefined4 local_4;

  

  local_24 = *param_2;

  local_1c = param_2[2];

  local_20 = param_2[1];

  FUN_004562a0(&local_18,param_3,&local_24);

  local_24 = local_18;

  local_20 = local_14;

  local_1c = local_10;

  *param_1 = local_18;

  param_1[1] = local_14;

  param_1[2] = local_10;

  param_1[3] = local_18;

  param_1[4] = local_14;

  param_1[5] = local_10;

  local_18 = param_2[3];

  local_14 = param_2[4];

  local_10 = param_2[5];

  FUN_004562a0(&local_c,param_3,&local_18);

  local_24 = local_c;

  local_20 = local_8;

  local_1c = local_4;

  FUN_00534e90(&local_24);

  local_c = param_2[3];

  local_10 = param_2[2];

  local_8 = param_2[4];

  local_4 = local_10;

  FUN_004562a0(&local_18,param_3,&local_c);

  local_24 = local_18;

  local_1c = local_10;

  local_20 = local_14;

  FUN_00534e90(&local_24);

  local_c = param_2[3];

  local_10 = param_2[5];

  local_8 = param_2[1];

  local_4 = local_10;

  FUN_004562a0(&local_18,param_3,&local_c);

  local_24 = local_18;

  local_20 = local_14;

  local_1c = local_10;

  FUN_00534e90(&local_24);

  local_c = *param_2;

  local_10 = param_2[5];

  local_8 = param_2[4];

  local_4 = local_10;

  FUN_004562a0(&local_18,param_3,&local_c);

  local_24 = local_18;

  local_20 = local_14;

  local_1c = local_10;

  FUN_00534e90(&local_24);

  local_c = *param_2;

  local_10 = param_2[2];

  local_8 = param_2[4];

  local_4 = local_10;

  FUN_004562a0(&local_18,param_3,&local_c);

  local_24 = local_18;

  local_20 = local_14;

  local_1c = local_10;

  FUN_00534e90(&local_24);

  local_c = param_2[3];

  local_10 = param_2[2];

  local_8 = param_2[1];

  local_4 = local_10;

  FUN_004562a0(&local_18,param_3,&local_c);

  local_24 = local_18;

  local_20 = local_14;

  local_1c = local_10;

  FUN_00534e90(&local_24);

  local_c = *param_2;

  local_10 = param_2[5];

  local_8 = param_2[1];

  local_4 = local_10;

  FUN_004562a0(&local_18,param_3,&local_c);

  local_24 = local_18;

  local_20 = local_14;

  local_1c = local_10;

  FUN_00534e90(&local_24);

  return;

}





// --- FUN_005b3490 at 0x005B3490 (size: 931) ---


void __thiscall FUN_005b3490(float *param_1,int param_2)



{

  float fVar1;

  float fVar2;

  float fVar3;

  float fVar4;

  float fVar5;

  float local_30;

  float local_2c;

  float local_28;

  float local_24;

  float local_20;

  float local_1c;

  float local_18;

  float local_14;

  float local_10;

  float local_c;

  float local_8;

  float local_4;

  

  local_14 = param_1[4];

  local_24 = *param_1;

  local_20 = param_1[1];

  fVar1 = *param_1;

  local_1c = param_1[2];

  fVar2 = param_1[1];

  fVar3 = param_1[2];

  local_18 = param_1[3];

  local_10 = param_1[5];

  fVar5 = fVar1 * *(float *)(param_2 + 0x18) +

          fVar3 * *(float *)(param_2 + 0x30) + fVar2 * *(float *)(param_2 + 0x24) +

          *(float *)(param_2 + 0x3c);

  fVar4 = fVar1 * *(float *)(param_2 + 0x1c) +

          fVar3 * *(float *)(param_2 + 0x34) + fVar2 * *(float *)(param_2 + 0x28) +

          *(float *)(param_2 + 0x40);

  fVar1 = fVar1 * *(float *)(param_2 + 0x20) +

          fVar3 * *(float *)(param_2 + 0x38) + fVar2 * *(float *)(param_2 + 0x2c) +

          *(float *)(param_2 + 0x44);

  *param_1 = fVar5;

  param_1[3] = fVar5;

  param_1[1] = fVar4;

  param_1[4] = fVar4;

  param_1[2] = fVar1;

  param_1[5] = fVar1;

  local_30 = local_18 * *(float *)(param_2 + 0x18) +

             local_14 * *(float *)(param_2 + 0x24) + local_1c * *(float *)(param_2 + 0x30) +

             *(float *)(param_2 + 0x3c);

  local_2c = local_18 * *(float *)(param_2 + 0x1c) +

             local_14 * *(float *)(param_2 + 0x28) + local_1c * *(float *)(param_2 + 0x34) +

             *(float *)(param_2 + 0x40);

  local_28 = local_18 * *(float *)(param_2 + 0x20) +

             local_14 * *(float *)(param_2 + 0x2c) + local_1c * *(float *)(param_2 + 0x38) +

             *(float *)(param_2 + 0x44);

  local_c = local_30;

  local_8 = local_2c;

  local_4 = local_28;

  FUN_00534e90(&local_30);

  local_30 = local_18 * *(float *)(param_2 + 0x18) +

             local_20 * *(float *)(param_2 + 0x24) + local_10 * *(float *)(param_2 + 0x30) +

             *(float *)(param_2 + 0x3c);

  local_2c = local_18 * *(float *)(param_2 + 0x1c) +

             local_20 * *(float *)(param_2 + 0x28) + local_10 * *(float *)(param_2 + 0x34) +

             *(float *)(param_2 + 0x40);

  local_28 = local_18 * *(float *)(param_2 + 0x20) +

             local_20 * *(float *)(param_2 + 0x2c) + local_10 * *(float *)(param_2 + 0x38) +

             *(float *)(param_2 + 0x44);

  local_c = local_30;

  local_8 = local_2c;

  local_4 = local_28;

  FUN_00534e90(&local_30);

  local_30 = local_24 * *(float *)(param_2 + 0x18) +

             local_14 * *(float *)(param_2 + 0x24) + local_10 * *(float *)(param_2 + 0x30) +

             *(float *)(param_2 + 0x3c);

  local_2c = local_24 * *(float *)(param_2 + 0x1c) +

             local_14 * *(float *)(param_2 + 0x28) + local_10 * *(float *)(param_2 + 0x34) +

             *(float *)(param_2 + 0x40);

  local_28 = local_24 * *(float *)(param_2 + 0x20) +

             local_14 * *(float *)(param_2 + 0x2c) + local_10 * *(float *)(param_2 + 0x38) +

             *(float *)(param_2 + 0x44);

  local_c = local_30;

  local_8 = local_2c;

  local_4 = local_28;

  FUN_00534e90(&local_30);

  local_30 = local_24 * *(float *)(param_2 + 0x18) +

             local_14 * *(float *)(param_2 + 0x24) + local_1c * *(float *)(param_2 + 0x30) +

             *(float *)(param_2 + 0x3c);

  local_2c = local_24 * *(float *)(param_2 + 0x1c) +

             local_14 * *(float *)(param_2 + 0x28) + local_1c * *(float *)(param_2 + 0x34) +

             *(float *)(param_2 + 0x40);

  local_28 = local_24 * *(float *)(param_2 + 0x20) +

             local_14 * *(float *)(param_2 + 0x2c) + local_1c * *(float *)(param_2 + 0x38) +

             *(float *)(param_2 + 0x44);

  local_c = local_30;

  local_8 = local_2c;

  local_4 = local_28;

  FUN_00534e90(&local_30);

  local_30 = local_18 * *(float *)(param_2 + 0x18) +

             local_20 * *(float *)(param_2 + 0x24) + local_1c * *(float *)(param_2 + 0x30) +

             *(float *)(param_2 + 0x3c);

  local_2c = local_18 * *(float *)(param_2 + 0x1c) +

             local_20 * *(float *)(param_2 + 0x28) + local_1c * *(float *)(param_2 + 0x34) +

             *(float *)(param_2 + 0x40);

  local_28 = local_18 * *(float *)(param_2 + 0x20) +

             local_20 * *(float *)(param_2 + 0x2c) + local_1c * *(float *)(param_2 + 0x38) +

             *(float *)(param_2 + 0x44);

  local_c = local_30;

  local_8 = local_2c;

  local_4 = local_28;

  FUN_00534e90(&local_30);

  local_30 = local_24 * *(float *)(param_2 + 0x18) +

             local_20 * *(float *)(param_2 + 0x24) + local_10 * *(float *)(param_2 + 0x30) +

             *(float *)(param_2 + 0x3c);

  local_2c = local_24 * *(float *)(param_2 + 0x1c) +

             local_20 * *(float *)(param_2 + 0x28) + local_10 * *(float *)(param_2 + 0x34) +

             *(float *)(param_2 + 0x40);

  local_28 = local_24 * *(float *)(param_2 + 0x20) +

             local_20 * *(float *)(param_2 + 0x2c) + local_10 * *(float *)(param_2 + 0x38) +

             *(float *)(param_2 + 0x44);

  local_c = local_30;

  local_8 = local_2c;

  local_4 = local_28;

  FUN_00534e90(&local_30);

  return;

}





// --- FUN_005b3840 at 0x005B3840 (size: 50) ---


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



void __thiscall FUN_005b3840(float *param_1,float *param_2)



{

  float fVar1;

  float fVar2;

  

  fVar1 = (param_1[5] + param_1[2]) * _DAT_007938b8;

  fVar2 = (param_1[4] + param_1[1]) * _DAT_007938b8;

  *param_2 = (param_1[3] + *param_1) * _DAT_007938b8;

  param_2[1] = fVar2;

  param_2[2] = fVar1;

  return;

}





// --- FUN_005b3880 at 0x005B3880 (size: 77) ---


void FUN_005b3880(undefined4 *param_1,int param_2)



{

  undefined4 *puVar1;

  

  FUN_0040ad10(0xc);

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

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

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

      *puVar1 = *param_1;

      puVar1[1] = param_1[1];

      puVar1[2] = param_1[2];

      return;

    }

    *param_1 = *puVar1;

    param_1[1] = puVar1[1];

    param_1[2] = puVar1[2];

  }

  return;

}





// --- FUN_005b38d0 at 0x005B38D0 (size: 170) ---


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



void FUN_005b38d0(void)



{

  undefined4 uVar1;

  uint uVar2;

  int iVar3;

  int iVar4;

  undefined4 *puVar5;

  undefined4 *puVar6;

  

  srand(0);

  iVar3 = 0;

  do {

    iVar4 = iVar3;

    (&DAT_008ef9e8)[iVar4] = iVar4;

    uVar2 = rand();

    uVar2 = uVar2 & 0x800001ff;

    if ((int)uVar2 < 0) {

      uVar2 = (uVar2 - 1 | 0xfffffe00) + 1;

    }

    iVar3 = iVar4 + 1;

    *(float *)(iVar3 * 4 + 0x8ef1dc) = (float)(int)(uVar2 - 0x100) * _DAT_007e75f8;

  } while (iVar3 < 0x100);

  while (iVar4 != 0) {

    uVar1 = (&DAT_008ef9e8)[iVar4];

    uVar2 = rand();

    uVar2 = uVar2 & 0x800000ff;

    if ((int)uVar2 < 0) {

      uVar2 = (uVar2 - 1 | 0xffffff00) + 1;

    }

    iVar4 = iVar4 + -1;

    (&DAT_008ef9ec)[iVar4] = (&DAT_008ef9e8)[uVar2];

    (&DAT_008ef9e8)[uVar2] = uVar1;

  }

  puVar5 = &DAT_008ef1e0;

  puVar6 = &DAT_008ef5e0;

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

    *puVar6 = *puVar5;

    puVar5 = puVar5 + 1;

    puVar6 = puVar6 + 1;

  }

  puVar5 = &DAT_008ef9e8;

  puVar6 = &DAT_008efde8;

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

    *puVar6 = *puVar5;

    puVar5 = puVar5 + 1;

    puVar6 = puVar6 + 1;

  }

  return;

}





// --- FUN_005b3980 at 0x005B3980 (size: 143) ---


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



float10 FUN_005b3980(void)



{

  uint uVar1;

  float10 extraout_ST0;

  float10 fVar2;

  

  if (DAT_008224e4 != 0) {

    DAT_008224e4 = 0;

    FUN_005b38d0();

  }

  uVar1 = FUN_005df4c4();

  fVar2 = extraout_ST0 - (float10)(int)uVar1;

  return fVar2 * fVar2 * ((float10)_DAT_007c7200 - (fVar2 + fVar2)) *

         ((fVar2 - (float10)_DAT_007938b0) *

          (float10)(float)(&DAT_008ef1e0)[(&DAT_008ef9e8)[(uVar1 & 0xff) + 1 & 0xff]] -

         (float10)(float)(fVar2 * (float10)(float)(&DAT_008ef1e0)[(&DAT_008ef9e8)[uVar1 & 0xff]])) +

         (float10)(float)(fVar2 * (float10)(float)(&DAT_008ef1e0)[(&DAT_008ef9e8)[uVar1 & 0xff]]);

}





// --- FUN_005b3a10 at 0x005B3A10 (size: 319) ---


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



float10 FUN_005b3a10(double param_1,undefined4 param_2,undefined4 param_3,double param_4,

                    double param_5)



{

  double *pdVar1;

  double dVar2;

  double dVar3;

  double dVar4;

  int iVar5;

  int iVar6;

  float10 fVar7;

  float10 extraout_ST0;

  

  if ((DAT_008224e8 != '\0') || ((double)CONCAT44(param_3,param_2) != _DAT_008f0390)) {

    _DAT_008f0390 = param_2;

    iVar6 = 0;

    _DAT_008f0394 = param_3;

    if (_DAT_00795610 < param_5 != (_DAT_00795610 == param_5)) {

      do {

        fVar7 = (float10)_CIpow();

        (&DAT_008f01f8)[iVar6] = (double)fVar7;

        iVar6 = iVar6 + 1;

      } while ((double)iVar6 < param_5 != ((double)iVar6 == param_5));

    }

    DAT_008224e8 = '\0';

  }

  iVar6 = 0;

  dVar2 = _DAT_00795610;

  dVar3 = param_1;

  dVar4 = _DAT_00795610;

  while( true ) {

    param_1._0_4_ = SUB84(dVar3,0);

    param_1._4_4_ = (undefined4)((ulonglong)dVar3 >> 0x20);

    if (param_5 <= dVar4) break;

    fVar7 = (float10)FUN_005b3980(param_1._0_4_,param_1._4_4_);

    pdVar1 = (double *)(&DAT_008f01f8 + iVar6);

    iVar6 = iVar6 + 1;

    dVar2 = (double)(fVar7 * (float10)*pdVar1 + (float10)dVar2);

    dVar3 = dVar3 * param_4;

    dVar4 = (double)iVar6;

  }

  iVar5 = FUN_005df4c4();

  fVar7 = extraout_ST0;

  if (param_5 - (double)iVar5 != _DAT_00795610) {

    fVar7 = (float10)FUN_005b3980(param_1._0_4_,param_1._4_4_);

    fVar7 = fVar7 * (float10)(double)(&DAT_008f01f8)[iVar6] * (float10)(param_5 - (double)iVar5) +

            (float10)dVar2;

  }

  return fVar7;

}





// --- FUN_005b3b50 at 0x005B3B50 (size: 83) ---


int __thiscall FUN_005b3b50(int *param_1,undefined4 param_2)



{

  int iVar1;

  undefined4 *puVar2;

  

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

  if (iVar1 == 0) {

    return 0;

  }

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

    (**(code **)**(undefined4 **)(iVar1 + 8))(1);

  }

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

  puVar2 = (undefined4 *)FUN_005df0f5(8);

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

    *puVar2 = &PTR_FUN_007980d0;

    puVar2[1] = param_2;

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

    return iVar1;

  }

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

  return iVar1;

}





// --- FUN_005b3bb0 at 0x005B3BB0 (size: 228) ---


void __fastcall FUN_005b3bb0(int param_1)



{

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

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

  }

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

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

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

  }

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

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

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

  }

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

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

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

  }

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

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

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

  }

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

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

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

  }

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

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

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

  }

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

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

    (**(code **)**(undefined4 **)(param_1 + 8))(1);

  }

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

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

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

  }

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

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

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

  }

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

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

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

  }

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

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

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

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

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

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

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

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

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

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

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

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

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

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

  return;

}





// --- FUN_005b3ca0 at 0x005B3CA0 (size: 28) ---


undefined4 __fastcall FUN_005b3ca0(int param_1)



{

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

    return 0;

  }

  FUN_005b6dd0(*(int *)(param_1 + 8));

  return 1;

}





// --- FUN_005b3cc0 at 0x005B3CC0 (size: 96) ---


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



{

  uint uVar1;

  uint uVar2;

  uint uVar3;

  

  *param_3 = 0;

  if (param_2 == 0x1c) {

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

    uVar3 = 1;

    uVar2 = 0x10000;

  }

  else if (param_2 == 0x2c) {

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

    uVar3 = 8;

    uVar2 = 0x80000;

  }

  else {

    if (param_2 != 0x31) {

      return 0;

    }

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

    uVar3 = 4;

    uVar2 = 0x40000;

  }

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

    return 0;

  }

  *param_3 = uVar1 & uVar2;

  return 1;

}





// --- FUN_005b3d20 at 0x005B3D20 (size: 523) ---


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



{

  uint uVar1;

  uint uVar2;

  uint uVar3;

  

  *param_3 = 0;

  switch(param_2) {

  case 0xd:

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

    uVar3 = 2;

    uVar2 = 0x20000;

    break;

  case 0xe:

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

    uVar3 = 4;

    uVar2 = 0x40000;

    break;

  case 0xf:

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

    uVar3 = 8;

    uVar2 = 0x80000;

    break;

  case 0x10:

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

    uVar3 = 0x10;

    uVar2 = 0x100000;

    break;

  case 0x11:

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

    uVar3 = 0x20;

    uVar2 = 0x200000;

    break;

  case 0x12:

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

    uVar3 = 0x40;

    uVar2 = 0x400000;

    break;

  case 0x13:

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

    uVar3 = 0x80;

    uVar2 = 0x800000;

    break;

  default:

    goto switchD_005b3d44_caseD_14;

  case 0x16:

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

    uVar3 = 0x10;

    uVar2 = 0x100000;

    break;

  case 0x1d:

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

    uVar3 = 2;

    uVar2 = 0x20000;

    break;

  case 0x3e:

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

    uVar3 = 1;

    uVar2 = 0x10000;

    break;

  case 0x3f:

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

    uVar3 = 0x20;

    uVar2 = 0x200000;

    break;

  case 0x40:

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

    uVar3 = 1;

    uVar2 = 0x10000;

    break;

  case 0x41:

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

    uVar3 = 2;

    uVar2 = 0x20000;

    break;

  case 0x42:

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

    uVar3 = 4;

    uVar2 = 0x40000;

    break;

  case 0x43:

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

    uVar3 = 8;

    uVar2 = 0x80000;

    break;

  case 0x44:

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

    uVar3 = 0x10;

    uVar2 = 0x100000;

    break;

  case 0x45:

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

    uVar3 = 0x20;

    uVar2 = 0x200000;

    break;

  case 0x46:

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

    uVar3 = 0x40;

    uVar2 = 0x400000;

    break;

  case 0x47:

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

    uVar3 = 0x80;

    uVar2 = 0x800000;

    break;

  case 0x48:

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

    uVar3 = 0x100;

    uVar2 = 0x1000000;

    break;

  case 0x49:

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

    uVar3 = 0x200;

    uVar2 = 0x2000000;

    break;

  case 0x4a:

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

    uVar3 = 0x400;

    uVar2 = 0x4000000;

    break;

  case 0x4b:

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

    uVar3 = 0x800;

    uVar2 = 0x8000000;

    break;

  case 0x90:

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

    uVar3 = 0x1000;

    uVar2 = 0x10000000;

    break;

  case 0x98:

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

    uVar3 = 0x2000;

    uVar2 = 0x20000000;

    break;

  case 0xa5:

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

    uVar3 = 0x100;

    uVar2 = 0x1000000;

    break;

  case 0xa6:

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

    uVar3 = 0x4000;

    uVar2 = 0x40000000;

  }

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

    *param_3 = uVar1 & uVar2;

    return 1;

  }

switchD_005b3d44_caseD_14:

  return 0;

}





// --- FUN_005b4090 at 0x005B4090 (size: 237) ---


void __thiscall FUN_005b4090(int param_1,uint *param_2)



{

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

    *param_2 = *param_2 | 1;

  }

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

    *param_2 = *param_2 | 0x2000;

  }

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

    *param_2 = *param_2 | 2;

  }

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

    *param_2 = *param_2 | 4;

  }

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

    *param_2 = *param_2 | 8;

  }

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

    *param_2 = *param_2 | 0x1000;

  }

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

    *param_2 = *param_2 | 0x10;

  }

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

    *param_2 = *param_2 | 0x100;

  }

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

    *param_2 = *param_2 | 0x40;

  }

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

    *param_2 = *param_2 | 0x20;

  }

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

    *param_2 = *param_2 | 0x80;

  }

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

    *param_2 = *param_2 | 0x200;

  }

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

    *param_2 = *param_2 | 0x800;

  }

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

    *param_2 = *param_2 | 0x400;

  }

  if ((((((*(int *)(param_1 + 0x40) != 0) || (*(int *)(param_1 + 0x44) != 0)) ||

        (*(int *)(param_1 + 0x48) != 0)) ||

       ((*(int *)(param_1 + 0x4c) != 0 || (*(int *)(param_1 + 0x50) != 0)))) ||

      ((*(int *)(param_1 + 0x54) != 0 ||

       ((*(int *)(param_1 + 0x58) != 0 || (*(int *)(param_1 + 0x5c) != 0)))))) ||

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

    *param_2 = *param_2 | 0x4000;

  }

  return;

}





// --- FUN_005b4180 at 0x005B4180 (size: 354) ---


int __fastcall FUN_005b4180(int param_1)



{

  int iVar1;

  int iVar2;

  undefined4 local_4;

  

  local_4 = 0;

  iVar2 = 8;

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

    iVar2 = (**(code **)(**(int **)(param_1 + 0x18) + 0xc))(&local_4,0);

    iVar2 = iVar2 + 8;

  }

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

    iVar1 = (**(code **)(**(int **)(param_1 + 0x1c) + 0xc))(&local_4,0);

    iVar2 = iVar2 + iVar1;

  }

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

    iVar1 = (**(code **)(**(int **)(param_1 + 0x20) + 0xc))(&local_4,0);

    iVar2 = iVar2 + iVar1;

  }

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

    iVar1 = (**(code **)(**(int **)(param_1 + 0x24) + 0xc))(&local_4,0);

    iVar2 = iVar2 + iVar1;

  }

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

    iVar1 = (**(code **)(**(int **)(param_1 + 0x28) + 0xc))(&local_4,0);

    iVar2 = iVar2 + iVar1;

  }

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

    iVar1 = (**(code **)(**(int **)(param_1 + 0x2c) + 0xc))(&local_4,0);

    iVar2 = iVar2 + iVar1;

  }

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

    iVar1 = (**(code **)(**(int **)(param_1 + 0x30) + 0xc))(&local_4,0);

    iVar2 = iVar2 + iVar1;

  }

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

    iVar1 = (**(code **)(**(int **)(param_1 + 8) + 0xc))(&local_4,0);

    iVar2 = iVar2 + iVar1;

  }

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

    iVar1 = (**(code **)(**(int **)(param_1 + 0xc) + 0xc))(&local_4,0);

    iVar2 = iVar2 + iVar1;

  }

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

    iVar1 = (**(code **)(**(int **)(param_1 + 0x10) + 0xc))(&local_4,0);

    iVar2 = iVar2 + iVar1;

  }

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

    iVar1 = (**(code **)(**(int **)(param_1 + 0x14) + 0xc))(&local_4,0);

    iVar2 = iVar2 + iVar1;

  }

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

    iVar2 = iVar2 + 4;

  }

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

    iVar2 = iVar2 + 4;

  }

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

    iVar2 = iVar2 + 4;

  }

  if ((((((*(int *)(param_1 + 0x40) != 0) || (*(int *)(param_1 + 0x44) != 0)) ||

        (*(int *)(param_1 + 0x48) != 0)) ||

       ((*(int *)(param_1 + 0x4c) != 0 || (*(int *)(param_1 + 0x50) != 0)))) ||

      ((*(int *)(param_1 + 0x54) != 0 ||

       ((*(int *)(param_1 + 0x58) != 0 || (*(int *)(param_1 + 0x5c) != 0)))))) ||

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

    iVar2 = iVar2 + 0x24;

  }

  return iVar2;

}





// --- FUN_005b4350 at 0x005B4350 (size: 53) ---


undefined4 * __fastcall FUN_005b4350(undefined4 *param_1)



{

  *param_1 = &PTR_FUN_007e7668;

  param_1[2] = 0;

  param_1[3] = 0;

  param_1[4] = 0;

  param_1[5] = 0;

  param_1[6] = 0;

  param_1[7] = 0;

  param_1[8] = 0;

  param_1[9] = 0;

  param_1[10] = 0;

  param_1[0xb] = 0;

  param_1[0xc] = 0;

  FUN_005b3bb0();

  return param_1;

}





// --- FUN_005b4390 at 0x005B4390 (size: 22) ---


void __fastcall FUN_005b4390(undefined4 *param_1)



{

  *param_1 = &PTR_FUN_007e7668;

  FUN_005b3bb0();

  *param_1 = &PTR_FUN_0079385c;

  return;

}





// --- FUN_005b43b0 at 0x005B43B0 (size: 99) ---


void __thiscall FUN_005b43b0(int param_1,int param_2)



{

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

  return;

}





// --- FUN_005b4620 at 0x005B4620 (size: 85) ---


void FUN_005b4620(int *param_1,int param_2)



{

  int iVar1;

  

  if (param_2 == 0) {

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

      (*(code *)**(undefined4 **)*param_1)(1);

      *param_1 = 0;

      return;

    }

  }

  else {

    if (*param_1 == 0) {

      iVar1 = FUN_005df0f5(0x48);

      if (iVar1 != 0) {

        iVar1 = FUN_005b7370();

        *param_1 = iVar1;

        FUN_005b43b0(param_2);

        return;

      }

      *param_1 = 0;

    }

    FUN_005b43b0(param_2);

  }

  return;

}





// --- FUN_005b4890 at 0x005B4890 (size: 42) ---


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



{

  *param_1 = &PTR_FUN_007e7668;

  FUN_005b3bb0();

  *param_1 = &PTR_FUN_0079385c;

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

    operator_delete(param_1);

  }

  return param_1;

}





// --- FUN_005b48e0 at 0x005B48E0 (size: 42) ---


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



{

  undefined4 *puVar1;

  

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

    puVar1 = (undefined4 *)FUN_005d5760(&param_2);

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

      *param_3 = *puVar1;

      return 1;

    }

  }

  return 0;

}





// --- FUN_005b4970 at 0x005B4970 (size: 48) ---


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



{

  undefined4 *puVar1;

  

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

    puVar1 = (undefined4 *)FUN_00590b10(&param_2);

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

      *param_3 = *puVar1;

      param_3[1] = puVar1[1];

      return 1;

    }

  }

  return 0;

}





// --- FUN_005b49d0 at 0x005B49D0 (size: 44) ---


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



{

  *param_1 = &PTR_FUN_0079385c;

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

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

    operator_delete(param_1);

  }

  return param_1;

}





// --- FUN_005b4a00 at 0x005B4A00 (size: 44) ---


undefined4 __fastcall FUN_005b4a00(int param_1)



{

  int iVar1;

  

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

    iVar1 = FUN_005d5760(&stack0x00000004);

    if (iVar1 != 0) {

      FUN_0048a0a0(iVar1);

      return 1;

    }

  }

  return 0;

}





// --- FUN_005b4a30 at 0x005B4A30 (size: 1012) ---


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



{

  uint *puVar1;

  uint uVar2;

  int *piVar3;

  int iVar4;

  

  FUN_005b3bb0();

  puVar1 = (uint *)*param_2;

  uVar2 = *puVar1;

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

  *(uint *)(param_1 + 4) = puVar1[1];

  *param_2 = *param_2 + 4;

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

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

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

      piVar3 = (int *)0x0;

    }

    else {

      *piVar3 = (int)&PTR_FUN_007cfc64;

      piVar3[1] = 0;

      piVar3[2] = 0;

      piVar3[3] = 0x10;

      piVar3[4] = 0;

      FUN_005a8440();

    }

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

    (**(code **)(*piVar3 + 0x10))(param_2,param_3);

  }

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

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

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

      piVar3 = (int *)0x0;

    }

    else {

      *piVar3 = (int)&PTR_FUN_007e54ec;

      piVar3[1] = 0;

      piVar3[2] = 0;

      piVar3[3] = 8;

      piVar3[4] = 0;

      FUN_005a8440();

    }

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

    (**(code **)(*piVar3 + 0x10))(param_2,param_3);

  }

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

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

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

      piVar3 = (int *)0x0;

    }

    else {

      *piVar3 = (int)&PTR_FUN_007e5500;

      piVar3[1] = 0;

      piVar3[2] = 0;

      piVar3[3] = 8;

      piVar3[4] = 0;

      FUN_005a8440();

    }

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

    (**(code **)(*piVar3 + 0x10))(param_2,param_3);

  }

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

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

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

      piVar3 = (int *)0x0;

    }

    else {

      *piVar3 = (int)&PTR_FUN_007e5514;

      piVar3[1] = 0;

      piVar3[2] = 0;

      piVar3[3] = 8;

      piVar3[4] = 0;

      FUN_005a8440();

    }

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

    (**(code **)(*piVar3 + 0x10))(param_2,param_3);

  }

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

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

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

      piVar3 = (int *)0x0;

    }

    else {

      *piVar3 = (int)&PTR_FUN_007e553c;

      piVar3[1] = 0;

      piVar3[2] = 0;

      piVar3[3] = 8;

      piVar3[4] = 0;

      FUN_005a8440();

    }

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

    (**(code **)(*piVar3 + 0x10))(param_2,param_3);

  }

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

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

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

      piVar3 = (int *)0x0;

    }

    else {

      *piVar3 = (int)&PTR_FUN_007e5528;

      piVar3[1] = 0;

      piVar3[2] = 0;

      piVar3[3] = 8;

      piVar3[4] = 0;

      FUN_005a8440();

    }

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

    (**(code **)(*piVar3 + 0x10))(param_2,param_3);

  }

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

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

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

      piVar3 = (int *)0x0;

    }

    else {

      piVar3[1] = 0;

      piVar3[2] = 0;

      piVar3[3] = 0;

      FUN_00500570(8);

      *piVar3 = (int)&PTR_FUN_007e767c;

    }

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

    (**(code **)(*piVar3 + 0x10))(param_2,param_3);

  }

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

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

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

      piVar3 = (int *)0x0;

    }

    else {

      *piVar3 = (int)&PTR_FUN_007b0394;

      piVar3[1] = 0x3f800000;

      piVar3[2] = 0x3f800000;

      piVar3[3] = 0x3f800000;

      piVar3[4] = 0x3f800000;

      piVar3[5] = 0x3f800000;

      piVar3[6] = 0x3f800000;

      piVar3[7] = 0x3f800000;

      piVar3[8] = 0x3f800000;

    }

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

    (**(code **)(*piVar3 + 0x10))(param_2,param_3);

  }

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

    iVar4 = FUN_005df0f5(0x38);

    if (iVar4 == 0) {

      piVar3 = (int *)0x0;

    }

    else {

      piVar3 = (int *)FUN_005b70d0();

    }

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

    (**(code **)(*piVar3 + 0x10))(param_2,param_3);

  }

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

    iVar4 = FUN_005df0f5(0x48);

    if (iVar4 == 0) {

      piVar3 = (int *)0x0;

    }

    else {

      piVar3 = (int *)FUN_005b7370();

    }

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

    (**(code **)(*piVar3 + 0x10))(param_2,param_3);

  }

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

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

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

      piVar3 = (int *)0x0;

    }

    else {

      *piVar3 = (int)&PTR_FUN_007e7654;

      FUN_005b7560();

    }

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

    (**(code **)(*piVar3 + 0x10))(param_2,param_3);

  }

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

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

    *param_2 = *param_2 + 4;

  }

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

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

    *param_2 = *param_2 + 4;

  }

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

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

    *param_2 = *param_2 + 4;

  }

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

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

    iVar4 = *param_2;

    *param_2 = iVar4 + 4;

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

    iVar4 = *param_2;

    *param_2 = iVar4 + 4;

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

    iVar4 = *param_2;

    *param_2 = iVar4 + 4;

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

    iVar4 = *param_2;

    *param_2 = iVar4 + 4;

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

    iVar4 = *param_2;

    *param_2 = iVar4 + 4;

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

    iVar4 = *param_2;

    *param_2 = iVar4 + 4;

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

    iVar4 = *param_2;

    *param_2 = iVar4 + 4;

    *(undefined4 *)(param_1 + 0x5c) = *(undefined4 *)(iVar4 + 4);

    iVar4 = *param_2;

    *param_2 = iVar4 + 4;

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

    *param_2 = *param_2 + 4;

  }

  if ((uint)(*param_2 - (int)puVar1) <= param_3) {

    return 1;

  }

  *param_2 = (int)puVar1;

  return 0;

}





// --- FUN_005b52b0 at 0x005B52B0 (size: 984) ---


uint FUN_005b52b0(uint param_1,char *param_2,uint param_3)



{

  char *pcVar1;

  uint uVar2;

  char *pcVar3;

  bool bVar4;

  

  uVar2 = 1;

  bVar4 = (param_1 & 1) != 0;

  *param_2 = '\0';

  if (bVar4) {

    uVar2 = 9;

  }

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

    if (bVar4) {

      uVar2 = uVar2 + 9;

    }

    else {

      bVar4 = true;

      uVar2 = uVar2 + 8;

    }

  }

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

    if (bVar4) {

      uVar2 = uVar2 + 0xc;

    }

    else {

      bVar4 = true;

      uVar2 = uVar2 + 0xb;

    }

  }

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

    if (bVar4) {

      uVar2 = uVar2 + 5;

    }

    else {

      bVar4 = true;

      uVar2 = uVar2 + 4;

    }

  }

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

    if (bVar4) {

      uVar2 = uVar2 + 5;

    }

    else {

      bVar4 = true;

      uVar2 = uVar2 + 4;

    }

  }

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

    if (bVar4) {

      uVar2 = uVar2 + 5;

    }

    else {

      bVar4 = true;

      uVar2 = uVar2 + 4;

    }

  }

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

    if (bVar4) {

      uVar2 = uVar2 + 0xb;

    }

    else {

      bVar4 = true;

      uVar2 = uVar2 + 10;

    }

  }

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

    if (bVar4) {

      uVar2 = uVar2 + 7;

    }

    else {

      bVar4 = true;

      uVar2 = uVar2 + 6;

    }

  }

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

    if (bVar4) {

      uVar2 = uVar2 + 10;

    }

    else {

      uVar2 = uVar2 + 9;

    }

  }

  if (uVar2 <= param_3) {

    bVar4 = (param_1 & 1) != 0;

    if (bVar4) {

      *(undefined4 *)param_2 = s_Slashing_007e77bc._0_4_;

      *(undefined4 *)(param_2 + 4) = s_Slashing_007e77bc._4_4_;

      param_2[8] = s_Slashing_007e77bc[8];

    }

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

      if (bVar4) {

        pcVar1 = param_2 + -1;

        do {

          pcVar3 = pcVar1;

          pcVar1 = pcVar3 + 1;

        } while (pcVar3[1] != '\0');

        *(undefined4 *)(pcVar3 + 1) = s__Piercing_007e77a4._0_4_;

        *(undefined4 *)(pcVar3 + 5) = s__Piercing_007e77a4._4_4_;

        *(undefined2 *)(pcVar3 + 9) = s__Piercing_007e77a4._8_2_;

      }

      else {

        *(undefined4 *)param_2 = s_Piercing_007e77b0._0_4_;

        *(undefined4 *)(param_2 + 4) = s_Piercing_007e77b0._4_4_;

        param_2[8] = s_Piercing_007e77b0[8];

        bVar4 = true;

      }

    }

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

      if (bVar4) {

        pcVar1 = param_2 + -1;

        do {

          pcVar3 = pcVar1;

          pcVar1 = pcVar3 + 1;

        } while (pcVar3[1] != '\0');

        *(undefined4 *)(pcVar3 + 1) = s__Bludgeoning_007e7788._0_4_;

        *(undefined4 *)(pcVar3 + 5) = s__Bludgeoning_007e7788._4_4_;

        *(undefined4 *)(pcVar3 + 9) = s__Bludgeoning_007e7788._8_4_;

        pcVar3[0xd] = s__Bludgeoning_007e7788[0xc];

      }

      else {

        *(undefined4 *)param_2 = s_Bludgeoning_007e7798._0_4_;

        *(undefined4 *)(param_2 + 4) = s_Bludgeoning_007e7798._4_4_;

        bVar4 = true;

        *(undefined4 *)(param_2 + 8) = s_Bludgeoning_007e7798._8_4_;

      }

    }

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

      if (bVar4) {

        pcVar1 = param_2 + -1;

        do {

          pcVar3 = pcVar1;

          pcVar1 = pcVar3 + 1;

        } while (pcVar3[1] != '\0');

        *(undefined4 *)(pcVar3 + 1) = DAT_007e7778;

        *(undefined2 *)(pcVar3 + 5) = DAT_007e777c;

      }

      else {

        *(undefined4 *)param_2 = DAT_007e7780;

        bVar4 = true;

        param_2[4] = DAT_007e7784;

      }

    }

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

      if (bVar4) {

        pcVar1 = param_2 + -1;

        do {

          pcVar3 = pcVar1;

          pcVar1 = pcVar3 + 1;

        } while (pcVar3[1] != '\0');

        *(undefined4 *)(pcVar3 + 1) = s__Fire_007e7768._0_4_;

        *(undefined2 *)(pcVar3 + 5) = s__Fire_007e7768._4_2_;

      }

      else {

        *(undefined4 *)param_2 = DAT_007e7770;

        bVar4 = true;

        param_2[4] = DAT_007e7774;

      }

    }

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

      if (bVar4) {

        pcVar1 = param_2 + -1;

        do {

          pcVar3 = pcVar1;

          pcVar1 = pcVar3 + 1;

        } while (pcVar3[1] != '\0');

        *(undefined4 *)(pcVar3 + 1) = DAT_007e7758;

        *(undefined2 *)(pcVar3 + 5) = DAT_007e775c;

      }

      else {

        *(undefined4 *)param_2 = DAT_007e7760;

        bVar4 = true;

        param_2[4] = DAT_007e7764;

      }

    }

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

      if (bVar4) {

        pcVar1 = param_2 + -1;

        do {

          pcVar3 = pcVar1;

          pcVar1 = pcVar3 + 1;

        } while (pcVar3[1] != '\0');

        *(undefined4 *)(pcVar3 + 1) = s__Electrical_007e7740._0_4_;

        *(undefined4 *)(pcVar3 + 5) = s__Electrical_007e7740._4_4_;

        *(undefined4 *)(pcVar3 + 9) = s__Electrical_007e7740._8_4_;

      }

      else {

        *(undefined4 *)param_2 = s_Electrical_007e774c._0_4_;

        *(undefined4 *)(param_2 + 4) = s_Electrical_007e774c._4_4_;

        *(undefined2 *)(param_2 + 8) = s_Electrical_007e774c._8_2_;

        bVar4 = true;

        param_2[10] = s_Electrical_007e774c[10];

      }

    }

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

      if (bVar4) {

        pcVar1 = param_2 + -1;

        do {

          pcVar3 = pcVar1;

          pcVar1 = pcVar3 + 1;

        } while (pcVar3[1] != '\0');

        *(undefined4 *)(pcVar3 + 1) = s__Nether_007e7730._0_4_;

        *(undefined4 *)(pcVar3 + 5) = s__Nether_007e7730._4_4_;

      }

      else {

        *(undefined4 *)param_2 = s_Nether_007e7738._0_4_;

        *(undefined2 *)(param_2 + 4) = s_Nether_007e7738._4_2_;

        bVar4 = true;

        param_2[6] = s_Nether_007e7738[6];

      }

    }

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

      if (!bVar4) {

        *(undefined4 *)param_2 = s_Prismatic_007e7724._0_4_;

        *(undefined4 *)(param_2 + 4) = s_Prismatic_007e7724._4_4_;

        *(undefined2 *)(param_2 + 8) = s_Prismatic_007e7724._8_2_;

        return uVar2;

      }

      pcVar1 = param_2 + -1;

      do {

        pcVar3 = pcVar1;

        pcVar1 = pcVar3 + 1;

      } while (pcVar3[1] != '\0');

      *(undefined4 *)(pcVar3 + 1) = s__Prismatic_007e7718._0_4_;

      *(undefined4 *)(pcVar3 + 5) = s__Prismatic_007e7718._4_4_;

      *(undefined2 *)(pcVar3 + 9) = s__Prismatic_007e7718._8_2_;

      pcVar3[0xb] = s__Prismatic_007e7718[10];

    }

  }

  return uVar2;

}





// --- FUN_005b5690 at 0x005B5690 (size: 22) ---


undefined1 FUN_005b5690(undefined4 param_1,undefined4 param_2)



{

  undefined1 uVar1;

  

  uVar1 = FUN_005ce450(param_1,param_2);

  return uVar1;

}





// --- FUN_005b57c0 at 0x005B57C0 (size: 168) ---


undefined4 FUN_005b57c0(undefined *param_1)



{

  int iVar1;

  char cVar2;

  

  iVar1 = (int)param_1;

  if (param_1 == (undefined *)0x2) {

    FUN_004034c0("Gharu\'ndim");

    return 1;

  }

  if (param_1 == (undefined *)0x5) {

    FUN_004034c0("Umbraen");

    return 1;

  }

  if (param_1 == (undefined *)0xd) {

    FUN_004034c0("Olthoi");

    return 1;

  }

  param_1 = PTR_DAT_00818344;

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

  cVar2 = FUN_0041b060(0x10000002,iVar1,&param_1);

  if (cVar2 == '\0') {

    FUN_004011b0();

    return 0;

  }

  FUN_004034c0(param_1);

  FUN_004011b0();

  return 1;

}





// --- FUN_005b5870 at 0x005B5870 (size: 141) ---


undefined4 FUN_005b5870(undefined4 param_1)



{

  char cVar1;

  LONG LVar2;

  undefined4 *puVar3;

  undefined *local_4;

  

  local_4 = PTR_DAT_00818344;

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

  cVar1 = FUN_0041b060(0x10000001,param_1,&local_4);

  if (cVar1 == '\0') {

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

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

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

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

    }

    return 0;

  }

  FUN_004034c0(local_4);

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

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

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

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

  }

  return 1;

}





// --- FUN_005b5a20 at 0x005B5A20 (size: 184) ---


void FUN_005b5a20(undefined4 *param_1)



{

  undefined4 *puVar1;

  LONG LVar2;

  char *pcVar3;

  

  if ((int)param_1 < 0xb) {

    pcVar3 = "Very Fast";

  }

  else if ((int)param_1 < 0x1f) {

    pcVar3 = "Fast";

  }

  else {

    if (0x31 < (int)param_1) {

      if ((int)param_1 < 0x50) {

        FUN_0048c3e0(&DAT_007e78b8);

        FUN_004914f0(&param_1);

        FUN_005abb30();

        return;

      }

      FUN_0048c3e0("Very Slow");

      FUN_004914f0(&param_1);

      FUN_005abb30();

      return;

    }

    pcVar3 = "Average";

  }

  FUN_0048c3e0(pcVar3);

  puVar1 = param_1;

  if ((param_1[2] != 1) && (param_1 != DAT_008ef11c)) {

    FUN_004910c0(param_1 + 5,param_1[2] + -1);

  }

  LVar2 = InterlockedDecrement(puVar1 + 1);

  if (LVar2 == 0) {

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

  }

  return;

}





// --- FUN_005b5ae0 at 0x005B5AE0 (size: 1056) ---


undefined4 FUN_005b5ae0(undefined4 param_1)



{

  char *pcVar1;

  

  switch(param_1) {

  case 1:

    FUN_0048c3e0(&DAT_007e7b40);

    break;

  case 2:

    pcVar1 = "Bow";

    goto LAB_005b5ed7;

  case 3:

    FUN_0048c3e0("Crossbow");

    break;

  case 4:

    FUN_0048c3e0("Dagger");

    break;

  case 5:

    pcVar1 = "Mace";

    goto LAB_005b5ed7;

  case 6:

    FUN_0048c3e0("Melee Defense");

    break;

  case 7:

    pcVar1 = "Missile Defense";

    goto LAB_005b5ed7;

  case 8:

    FUN_0048c3e0("Sling");

    break;

  case 9:

    FUN_0048c3e0("Spear");

    break;

  case 10:

    pcVar1 = "Staff";

    goto LAB_005b5ed7;

  case 0xb:

    FUN_0048c3e0("Sword");

    break;

  case 0xc:

    FUN_0048c3e0("Thrown Weapon");

    break;

  case 0xd:

    pcVar1 = "Unarmed Combat";

    goto LAB_005b5ed7;

  case 0xe:

    FUN_0048c3e0("Arcane Lore");

    break;

  case 0xf:

    FUN_0048c3e0("Magic Defense");

    break;

  case 0x10:

    pcVar1 = "Mana Conversion";

    goto LAB_005b5ed7;

  case 0x11:

    FUN_0048c3e0("Spellcraft");

    break;

  case 0x12:

    FUN_0048c3e0("Item Tinkering");

    break;

  case 0x13:

    pcVar1 = "Person Appraisal";

    goto LAB_005b5ed7;

  case 0x14:

    FUN_0048c3e0("Deception");

    break;

  case 0x15:

    FUN_0048c3e0("Healing");

    break;

  case 0x16:

    pcVar1 = "Jump";

    goto LAB_005b5ed7;

  case 0x17:

    FUN_0048c3e0("Lockpick");

    break;

  case 0x18:

    FUN_0048c3e0(&DAT_007e7a24);

    break;

  case 0x19:

    pcVar1 = "Awareness";

    goto LAB_005b5ed7;

  case 0x1a:

    FUN_0048c3e0("Armor Repair");

    break;

  case 0x1b:

    FUN_0048c3e0("Creature Appraisal");

    break;

  case 0x1c:

    pcVar1 = "Weapon Tinkering";

    goto LAB_005b5ed7;

  case 0x1d:

    FUN_0048c3e0("Armor Tinkering");

    break;

  case 0x1e:

    FUN_0048c3e0("Magic Item Tinkering");

    break;

  case 0x1f:

    pcVar1 = "Creature Enchantment";

    goto LAB_005b5ed7;

  case 0x20:

    FUN_0048c3e0("Item Enchantment");

    break;

  case 0x21:

    FUN_0048c3e0("Life Magic");

    break;

  case 0x22:

    pcVar1 = "War Magic";

    goto LAB_005b5ed7;

  case 0x23:

    FUN_0048c3e0("Leadership");

    break;

  case 0x24:

    pcVar1 = "Loyalty";

    goto LAB_005b5ed7;

  case 0x25:

    FUN_0048c3e0("Fletching");

    break;

  case 0x26:

    FUN_0048c3e0("Alchemy");

    break;

  case 0x27:

    pcVar1 = "Cooking";

    goto LAB_005b5ed7;

  case 0x28:

    FUN_0048c3e0("Salvaging");

    break;

  case 0x29:

    FUN_0048c3e0("Two Handed Combat");

    break;

  case 0x2a:

    FUN_0048c3e0("Gearcraft");

    break;

  case 0x2b:

    FUN_0048c3e0("Void Magic");

    break;

  case 0x2c:

    pcVar1 = "Heavy Weapons";

    goto LAB_005b5ed7;

  case 0x2d:

    FUN_0048c3e0("Light Weapons");

    break;

  case 0x2e:

    FUN_0048c3e0("Finesse Weapons");

    break;

  case 0x2f:

    pcVar1 = "Missile Weapons";

    goto LAB_005b5ed7;

  default:

    return 0;

  case 0x31:

    FUN_0048c3e0("Dual Wield");

    break;

  case 0x32:

    FUN_0048c3e0("Recklessness");

    break;

  case 0x33:

    pcVar1 = "Sneak Attack";

    goto LAB_005b5ed7;

  case 0x34:

    FUN_0048c3e0("Dirty Fighting");

    break;

  case 0x35:

    FUN_0048c3e0("Challenge");

    break;

  case 0x36:

    pcVar1 = "Summoning";

LAB_005b5ed7:

    FUN_0048c3e0(pcVar1);

  }

  FUN_004914f0(&param_1);

  FUN_005abb30();

  return 1;

}





// --- FUN_005b6a90 at 0x005B6A90 (size: 250) ---


undefined4 FUN_005b6a90(undefined4 param_1)



{

  char cVar1;

  LONG LVar2;

  undefined4 *puVar3;

  undefined *local_c;

  undefined4 *local_8;

  undefined4 *local_4;

  

  local_c = PTR_DAT_00818344;

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

  cVar1 = FUN_0041b060(0x10000005,param_1,&local_c);

  if (cVar1 == '\0') {

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

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

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

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

    }

    return 0;

  }

  FUN_004034c0(local_c);

  FUN_0048c3e0(&DAT_00795098);

  FUN_0048c3e0(&DAT_00795500);

  FUN_00566d10(&local_8,&local_4);

  LVar2 = InterlockedDecrement(local_8 + 1);

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

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

  }

  LVar2 = InterlockedDecrement(local_4 + 1);

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

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

  }

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

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

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

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

  }

  return 1;

}





// --- FUN_005b6b90 at 0x005B6B90 (size: 566) ---


bool FUN_005b6b90(int param_1,int param_2,int param_3,int *param_4)



{

  int *piVar1;

  LONG LVar2;

  int iVar3;

  LONG *lpAddend;

  bool bVar4;

  undefined4 *puVar5;

  undefined4 *puVar6;

  bool bVar7;

  

  piVar1 = param_4;

  puVar6 = (undefined4 *)*param_4;

  if (puVar6 != DAT_008ef11c) {

    LVar2 = InterlockedDecrement(puVar6 + 1);

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

      (**(code **)*puVar6)(1);

    }

    lpAddend = DAT_008ef11c + 1;

    *piVar1 = (int)DAT_008ef11c;

    InterlockedIncrement(lpAddend);

  }

  bVar7 = false;

  bVar4 = true;

  if (param_1 != 0) {

    param_4 = DAT_008ef11c;

    InterlockedIncrement(DAT_008ef11c + 1);

    iVar3 = FUN_005b5870(param_1,&param_4);

    puVar6 = param_4;

    bVar7 = iVar3 != 0;

    if (bVar7) {

      FUN_004034c0(param_4 + 5);

    }

    LVar2 = InterlockedDecrement(puVar6 + 1);

    bVar4 = bVar7;

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

      (**(code **)*puVar6)(1);

    }

  }

  if (param_2 == 0) {

    if (param_3 == 0) {

      return bVar4;

    }

    param_4 = DAT_008ef11c;

    InterlockedIncrement(DAT_008ef11c + 1);

    iVar3 = FUN_005b6a90(param_3,&param_4);

    puVar6 = param_4;

    if (iVar3 == 0) goto LAB_005b6cf3;

    if (bVar7) {

      FUN_0048c3e0(&DAT_00795098);

      FUN_004914f0(&param_4);

      FUN_005abb30();

    }

    FUN_0048c3e0(puVar6 + 5);

    puVar5 = param_4;

    if ((param_4[2] != 1) && (param_4 != DAT_008ef11c)) {

      FUN_004910c0(param_4 + 5,param_4[2] + -1);

    }

  }

  else {

    param_4 = DAT_008ef11c;

    InterlockedIncrement(DAT_008ef11c + 1);

    iVar3 = FUN_005b57c0(param_2,&param_4);

    puVar6 = param_4;

    if (iVar3 == 0) {

LAB_005b6cf3:

      bVar4 = false;

      puVar6 = param_4;

      goto LAB_005b6d9a;

    }

    if (bVar7) {

      FUN_0048c3e0(&DAT_00795098);

      puVar5 = param_4;

      if ((param_4[2] != 1) && (param_4 != DAT_008ef11c)) {

        FUN_004910c0(param_4 + 5,param_4[2] + -1);

      }

      LVar2 = InterlockedDecrement(puVar5 + 1);

      if (LVar2 == 0) {

        (**(code **)*puVar5)(1);

      }

    }

    FUN_0048c3e0(puVar6 + 5);

    puVar5 = param_4;

    if ((param_4[2] != 1) && (param_4 != DAT_008ef11c)) {

      FUN_004910c0(param_4 + 5,param_4[2] + -1);

    }

  }

  LVar2 = InterlockedDecrement(puVar5 + 1);

  if (LVar2 == 0) {

    (**(code **)*puVar5)(1);

  }

LAB_005b6d9a:

  LVar2 = InterlockedDecrement(puVar6 + 1);

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

    (**(code **)*puVar6)(1);

  }

  return bVar4;

}





// --- FUN_005b6dd0 at 0x005B6DD0 (size: 91) ---


void __thiscall FUN_005b6dd0(int param_1,int param_2)



{

  if (param_1 != param_2) {

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

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

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

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

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

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

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

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

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

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

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

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

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

  }

  return;

}





// --- FUN_005b6e30 at 0x005B6E30 (size: 122) ---


bool __thiscall FUN_005b6e30(int param_1,undefined4 param_2,int *param_3)



{

  int iVar1;

  

  switch(param_2) {

  case 1:

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

    return *param_3 != 0;

  case 2:

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

    break;

  case 3:

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

    return *param_3 != 0;

  case 4:

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

    break;

  case 5:

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

    return *param_3 != 0;

  case 6:

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

    break;

  default:

    return false;

  }

  *param_3 = iVar1;

  return iVar1 != 0;

}





// --- FUN_005b6ed0 at 0x005B6ED0 (size: 122) ---


bool __thiscall FUN_005b6ed0(int param_1,undefined4 param_2,int *param_3)



{

  int iVar1;

  

  switch(param_2) {

  case 1:

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

    break;

  case 2:

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

    return *param_3 != 0;

  case 3:

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

    return *param_3 != 0;

  case 4:

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

    break;

  case 5:

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

    break;

  case 6:

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

    return *param_3 != 0;

  default:

    return false;

  }

  *param_3 = iVar1;

  return iVar1 != 0;

}





// --- FUN_005b6f70 at 0x005B6F70 (size: 202) ---


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



{

  switch(param_2) {

  case 1:

    if ((*(uint *)(param_1 + 0x34) & 1) != 0) {

      *param_3 = *(uint *)(param_1 + 0x34) & 0x10000;

      return 1;

    }

    break;

  case 2:

    if ((*(uint *)(param_1 + 0x34) & 2) != 0) {

      *param_3 = *(uint *)(param_1 + 0x34) & 0x20000;

      return 1;

    }

    break;

  case 3:

    if ((*(uint *)(param_1 + 0x34) & 4) != 0) {

      *param_3 = *(uint *)(param_1 + 0x34) & 0x40000;

      return 1;

    }

    break;

  case 4:

    if ((*(uint *)(param_1 + 0x34) & 8) != 0) {

      *param_3 = *(uint *)(param_1 + 0x34) & 0x80000;

      return 1;

    }

    break;

  case 5:

    if ((*(uint *)(param_1 + 0x34) & 0x10) != 0) {

      *param_3 = *(uint *)(param_1 + 0x34) & 0x100000;

      return 1;

    }

    break;

  case 6:

    if ((*(uint *)(param_1 + 0x34) & 0x20) != 0) {

      *param_3 = *(uint *)(param_1 + 0x34) & 0x200000;

      return 1;

    }

  }

  return 0;

}





// --- FUN_005b7060 at 0x005B7060 (size: 107) ---


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



{

  if (param_2 == 1) {

    if ((*(uint *)(param_1 + 0x34) & 0x40) != 0) {

      *param_3 = *(uint *)(param_1 + 0x34) & 0x400000;

      return 1;

    }

  }

  else if (param_2 == 3) {

    if ((char)*(uint *)(param_1 + 0x34) < '\0') {

      *param_3 = *(uint *)(param_1 + 0x34) & 0x800000;

      return 1;

    }

  }

  else if ((param_2 == 5) && ((*(uint *)(param_1 + 0x34) & 0x100) != 0)) {

    *param_3 = *(uint *)(param_1 + 0x34) & 0x1000000;

    return 1;

  }

  return 0;

}





// --- FUN_005b70d0 at 0x005B70D0 (size: 50) ---


void __fastcall FUN_005b70d0(undefined4 *param_1)



{

  *param_1 = &PTR_FUN_007e7d9c;

  param_1[1] = 0;

  param_1[2] = 0;

  param_1[3] = 0;

  param_1[4] = 0;

  param_1[5] = 0;

  param_1[6] = 0;

  param_1[7] = 0;

  param_1[8] = 0;

  param_1[9] = 0;

  param_1[10] = 0;

  param_1[0xb] = 0;

  param_1[0xc] = 0;

  param_1[0xd] = 0;

  return;

}





// --- FUN_005b713e at 0x005B713E (size: 251) ---


void __fastcall

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



{

  int iVar1;

  uint in_EAX;

  uint uVar2;

  undefined4 *puVar3;

  uint *unaff_EDI;

  

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

    in_EAX = 0x10;

  }

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

    in_EAX = in_EAX + 0x28;

  }

  if (in_EAX <= param_5) {

    uVar2 = (uint)(*(int *)(param_1 + 0x34) != 0);

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

      uVar2 = uVar2 | 8;

    }

    *unaff_EDI = uVar2;

    iVar1 = *param_2;

    *param_2 = iVar1 + 4;

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

    iVar1 = *param_2;

    *param_2 = iVar1 + 4;

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

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

    *param_2 = (int)puVar3;

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

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

      iVar1 = *param_2;

      *param_2 = iVar1 + 4;

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

      iVar1 = *param_2;

      *param_2 = iVar1 + 4;

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

      iVar1 = *param_2;

      *param_2 = iVar1 + 4;

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

      iVar1 = *param_2;

      *param_2 = iVar1 + 4;

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

      iVar1 = *param_2;

      *param_2 = iVar1 + 4;

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

      iVar1 = *param_2;

      *param_2 = iVar1 + 4;

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

      iVar1 = *param_2;

      *param_2 = iVar1 + 4;

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

      iVar1 = *param_2;

      *param_2 = iVar1 + 4;

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

      iVar1 = *param_2;

      *param_2 = iVar1 + 4;

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

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

      *param_2 = (int)puVar3;

    }

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

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

      *param_2 = *param_2 + 4;

    }

  }

  return;

}





// --- FUN_005b7370 at 0x005B7370 (size: 65) ---


void __fastcall FUN_005b7370(undefined4 *param_1)



{

  *param_1 = &PTR_FUN_007e7db4;

  param_1[1] = 0;

  param_1[2] = 0;

  param_1[3] = 0;

  param_1[4] = 0;

  param_1[6] = 0;

  param_1[7] = 0x3fd00000;

  param_1[8] = 0;

  param_1[9] = 0x3ff00000;

  param_1[10] = 0;

  param_1[0xb] = 0;

  param_1[0xc] = 0;

  param_1[0xd] = 0;

  param_1[0xe] = 0;

  param_1[0xf] = 0x3ff00000;

  param_1[0x10] = 0;

  return;

}





// --- FUN_005b7540 at 0x005B7540 (size: 31) ---


void __thiscall FUN_005b7540(int param_1,int param_2)



{

  if (param_1 != param_2) {

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

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

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

  }

  return;

}





// --- FUN_005b7560 at 0x005B7560 (size: 12) ---


void __fastcall FUN_005b7560(int param_1)



{

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

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

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

  return;

}





// --- FUN_005b75e0 at 0x005B75E0 (size: 58) ---


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



{

  int iVar1;

  

  if (param_3 < 0xc) {

    return 0;

  }

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

  iVar1 = *param_2;

  *param_2 = iVar1 + 4;

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

  iVar1 = *param_2;

  *param_2 = iVar1 + 4;

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

  *param_2 = *param_2 + 4;

  return 1;

}





// --- FUN_005b7620 at 0x005B7620 (size: 28) ---


void __thiscall FUN_005b7620(int param_1,undefined4 param_2)



{

  FUN_005b9f10(*(undefined4 *)(param_1 + 0x14),*(undefined4 *)(param_1 + 0x10),

               *(undefined4 *)(param_1 + 0xc),param_2);

  return;

}





// --- FUN_005b7640 at 0x005B7640 (size: 7) ---


uint __fastcall FUN_005b7640(int param_1)



{

  return *(uint *)(param_1 + 0x1c) & 1;

}





// --- FUN_005b7650 at 0x005B7650 (size: 29) ---


void __thiscall FUN_005b7650(int param_1,int param_2)



{

  if (param_2 != 0) {

    *(uint *)(param_1 + 0x1c) = *(uint *)(param_1 + 0x1c) | 0x10;

    return;

  }

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

  return;

}





// --- FUN_005b7670 at 0x005B7670 (size: 73) ---


undefined4 * __fastcall FUN_005b7670(undefined4 *param_1)



{

  LONG *lpAddend;

  

  *param_1 = &PTR_FUN_007e7dc8;

  param_1[1] = 0;

  lpAddend = (LONG *)(DAT_008ef11c + 4);

  param_1[2] = DAT_008ef11c;

  InterlockedIncrement(lpAddend);

  param_1[3] = 0;

  param_1[4] = 0;

  param_1[5] = 0;

  param_1[6] = 0;

  param_1[7] = 0;

  param_1[8] = 0;

  param_1[9] = 0;

  param_1[10] = 0;

  param_1[0xb] = 0;

  param_1[0xc] = 0;

  param_1[0xd] = 0;

  return param_1;

}





// --- FUN_005b76c0 at 0x005B76C0 (size: 48) ---


void __fastcall FUN_005b76c0(undefined4 *param_1)



{

  undefined4 *puVar1;

  LONG LVar2;

  

  puVar1 = (undefined4 *)param_1[2];

  *param_1 = &PTR_FUN_007e7dc8;

  LVar2 = InterlockedDecrement(puVar1 + 1);

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

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

  }

  *param_1 = &PTR_FUN_0079385c;

  return;

}





// --- FUN_005b76f0 at 0x005B76F0 (size: 68) ---


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



{

  undefined4 *puVar1;

  LONG LVar2;

  

  puVar1 = (undefined4 *)param_1[2];

  *param_1 = &PTR_FUN_007e7dc8;

  LVar2 = InterlockedDecrement(puVar1 + 1);

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

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

  }

  *param_1 = &PTR_FUN_0079385c;

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

    operator_delete(param_1);

  }

  return param_1;

}





// --- FUN_005b7740 at 0x005B7740 (size: 145) ---


int __thiscall FUN_005b7740(int param_1,int param_2)



{

  undefined4 *puVar1;

  int iVar2;

  LONG LVar3;

  

  if (param_1 != param_2) {

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

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

    if (puVar1 != *(undefined4 **)(param_2 + 8)) {

      LVar3 = InterlockedDecrement(puVar1 + 1);

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

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

      }

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

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

      InterlockedIncrement((LONG *)(iVar2 + 4));

    }

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

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

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

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

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

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

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

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

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

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

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

  }

  return param_1;

}





// --- FUN_005b78e0 at 0x005B78E0 (size: 87) ---


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



{

  LONG *lpAddend;

  

  *param_1 = &PTR_FUN_007e7dc8;

  param_1[1] = 0;

  lpAddend = (LONG *)(DAT_008ef11c + 4);

  param_1[2] = DAT_008ef11c;

  InterlockedIncrement(lpAddend);

  param_1[3] = 0;

  param_1[4] = 0;

  param_1[5] = 0;

  param_1[6] = 0;

  param_1[7] = 0;

  param_1[8] = 0;

  param_1[9] = 0;

  param_1[10] = 0;

  param_1[0xb] = 0;

  param_1[0xc] = 0;

  param_1[0xd] = 0;

  FUN_005b7740(param_2);

  return param_1;

}





// --- FUN_005b7940 at 0x005B7940 (size: 254) ---


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



{

  byte bVar1;

  ushort uVar2;

  int iVar3;

  undefined4 uVar4;

  byte *pbVar5;

  

  if (param_3 < 0x20) {

    return 0;

  }

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

  iVar3 = *param_2;

  *param_2 = iVar3 + 4;

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

  iVar3 = *param_2;

  *param_2 = iVar3 + 4;

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

  iVar3 = *param_2;

  *param_2 = iVar3 + 4;

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

  iVar3 = *param_2;

  pbVar5 = (byte *)(iVar3 + 4);

  *param_2 = (int)pbVar5;

  bVar1 = *pbVar5;

  *param_2 = iVar3 + 5;

  *(uint *)(param_1 + 0xc) = (uint)bVar1;

  bVar1 = *(byte *)*param_2;

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

  *(uint *)(param_1 + 0x10) = (uint)bVar1;

  uVar2 = *(ushort *)*param_2;

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

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

  if ((*(uint *)(param_1 + 0x1c) & 8) == 0) {

    *(uint *)(param_1 + 0x1c) = *(uint *)(param_1 + 0x1c) | 0x10;

  }

  else {

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

    *param_2 = *param_2 + 4;

  }

  uVar2 = *(ushort *)*param_2;

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

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

  uVar2 = *(ushort *)*param_2;

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

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

  if ((*(byte *)(param_1 + 0x1c) & 4) == 0) {

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

    uVar4 = FUN_005df4c4();

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

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

  }

  else {

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

    iVar3 = *param_2;

    *param_2 = iVar3 + 4;

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

    *param_2 = *param_2 + 4;

  }

  FUN_004fd460(param_2,param_3);

  return 1;

}





// --- FUN_005b7a40 at 0x005B7A40 (size: 202) ---


undefined4 __thiscall FUN_005b7a40(int param_1,int *param_2)



{

  undefined4 *puVar1;

  int *piVar2;

  int iVar3;

  LONG LVar4;

  

  iVar3 = FUN_005b9f10(*(undefined4 *)(param_1 + 0x14),*(undefined4 *)(param_1 + 0x10),

                       *(undefined4 *)(param_1 + 0xc),param_2);

  if (iVar3 == 0) {

    puVar1 = (undefined4 *)*param_2;

    if (puVar1 != *(undefined4 **)(param_1 + 8)) {

      LVar4 = InterlockedDecrement(puVar1 + 1);

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

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

      }

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

      *param_2 = iVar3;

      InterlockedIncrement((LONG *)(iVar3 + 4));

    }

    return 0;

  }

  FUN_0048c3e0(&DAT_00795098);

  if ((param_2[2] != 1) && (param_2 != DAT_008ef11c)) {

    FUN_004910c0(param_2 + 5,param_2[2] + -1);

  }

  LVar4 = InterlockedDecrement(param_2 + 1);

  if (LVar4 == 0) {

    (**(code **)*param_2)(1);

  }

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

  if ((piVar2[2] != 1) && (piVar2 != DAT_008ef11c)) {

    FUN_004910c0(piVar2 + 5,piVar2[2] + -1);

  }

  return 1;

}





// --- FUN_005b7b10 at 0x005B7B10 (size: 53) ---


int __thiscall FUN_005b7b10(int param_1,int param_2)



{

  if (param_1 != param_2) {

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

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

    FUN_005b8ad0(param_2 + 4);

  }

  return param_1;

}





// --- FUN_005b7b50 at 0x005B7B50 (size: 22) ---


void __fastcall FUN_005b7b50(int param_1)



{

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

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

  FUN_005b8550();

  return;

}





// --- FUN_005b7b70 at 0x005B7B70 (size: 38) ---


int FUN_005b7b70(undefined4 param_1)



{

  int iVar1;

  

  iVar1 = FUN_005b7e10();

  if (iVar1 != 0) {

    FUN_005b7e90(iVar1,param_1);

  }

  return iVar1;

}





// --- FUN_005b7ba0 at 0x005B7BA0 (size: 8) ---


void FUN_005b7ba0(void)



{

  FUN_005b7ec0();

  return;

}





// --- FUN_005b7bb0 at 0x005B7BB0 (size: 8) ---


void FUN_005b7bb0(void)



{

  FUN_005b7f00();

  return;

}





// --- FUN_005b7bc0 at 0x005B7BC0 (size: 8) ---


void FUN_005b7bc0(void)



{

  FUN_005b7f40();

  return;

}





// --- FUN_005b7bd0 at 0x005B7BD0 (size: 8) ---


void FUN_005b7bd0(void)



{

  FUN_005b7e90();

  return;

}





// --- FUN_005b7c00 at 0x005B7C00 (size: 35) ---


undefined4 * __fastcall FUN_005b7c00(undefined4 *param_1)



{

  *param_1 = &PTR_FUN_007e7e14;

  FUN_005b8930();

  param_1[0x44] = 0;

  param_1[0x45] = 0;

  return param_1;

}





// --- FUN_005b7c30 at 0x005B7C30 (size: 72) ---


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



{

  int iVar1;

  uint uVar2;

  

  uVar2 = (**(code **)(*param_1 + 8))();

  if (uVar2 <= param_3) {

    *(int *)*param_2 = param_1[0x44];

    iVar1 = *param_2;

    *param_2 = iVar1 + 4;

    *(int *)(iVar1 + 4) = param_1[0x45];

    *param_2 = *param_2 + 4;

    (**(code **)(param_1[1] + 0xc))(param_2,param_3);

  }

  return uVar2;

}





// --- FUN_005b7c80 at 0x005B7C80 (size: 83) ---


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



{

  int iVar1;

  undefined4 uVar2;

  

  iVar1 = (**(code **)(*(int *)(param_1 + 4) + 0x14))();

  if (param_3 < iVar1 + 8U) {

    return 0;

  }

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

  iVar1 = *param_2;

  *param_2 = iVar1 + 4;

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

  *param_2 = *param_2 + 4;

  uVar2 = (**(code **)(*(int *)(param_1 + 4) + 0x10))(param_2,param_3);

  return uVar2;

}





// --- FUN_005b7ce0 at 0x005B7CE0 (size: 39) ---


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



{

  FUN_005b8c00();

  *param_1 = &PTR_FUN_0079385c;

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

    operator_delete(param_1);

  }

  return param_1;

}





// --- FUN_005b7d10 at 0x005B7D10 (size: 81) ---


void FUN_005b7d10(int *param_1)



{

  int iVar1;

  undefined4 *puVar2;

  int *piVar3;

  

  piVar3 = param_1;

  if (*param_1 != 0) {

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

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

      do {

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

        FUN_005b7d10(&param_1);

        param_1 = (int *)iVar1;

      } while (iVar1 != 0);

      param_1 = (int *)0x0;

    }

    puVar2 = (undefined4 *)*piVar3;

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

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

    }

    *piVar3 = 0;

  }

  return;

}





// --- FUN_005b7d70 at 0x005B7D70 (size: 90) ---


int FUN_005b7d70(int *param_1)



{

  int iVar1;

  int *piVar2;

  int iVar3;

  int iVar4;

  

  piVar2 = param_1;

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

    iVar1 = *param_1;

    iVar4 = param_1[1];

    param_1 = (int *)0x0;

    iVar3 = (**(code **)(iVar1 + 0xc))(&param_1,0);

    iVar3 = iVar3 + (-(uint)(iVar4 != 0) & 4);

    for (iVar1 = piVar2[3]; iVar1 != 0; iVar1 = *(int *)(iVar1 + 8)) {

      iVar4 = FUN_005b7d70(iVar1);

      iVar3 = iVar3 + iVar4;

    }

    return iVar3;

  }

  return 0;

}





// --- FUN_005b7dd0 at 0x005B7DD0 (size: 63) ---


int FUN_005b7dd0(int param_1,int param_2)



{

  int iVar1;

  int iVar2;

  

  if (param_2 == 0) {

    return 0;

  }

  if (param_1 != *(int *)(param_2 + 0x14)) {

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

      iVar2 = FUN_005b7dd0(param_1,iVar1);

      if (iVar2 != 0) {

        return iVar2;

      }

    }

    param_2 = 0;

  }

  return param_2;

}





// --- FUN_005b7e10 at 0x005B7E10 (size: 14) ---


undefined4 __fastcall FUN_005b7e10(int param_1)



{

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

    return *(undefined4 *)(*(int *)(param_1 + 8) + 0x14);

  }

  return 0;

}





// --- FUN_005b7e20 at 0x005B7E20 (size: 111) ---


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



{

  int iVar1;

  int iVar2;

  int iVar3;

  

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

    return 0;

  }

  if (param_1[1] == 0) {

    iVar3 = 0;

  }

  else {

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

    *param_2 = *param_2 + 4;

    iVar3 = 4;

  }

  iVar1 = (**(code **)(*param_1 + 0xc))(param_2,param_3);

  iVar3 = iVar3 + iVar1;

  for (iVar1 = param_1[3]; iVar1 != 0; iVar1 = *(int *)(iVar1 + 8)) {

    iVar2 = FUN_005b7e20(iVar1,param_2,param_3);

    iVar3 = iVar3 + iVar2;

  }

  return iVar3;

}





// --- FUN_005b7e90 at 0x005B7E90 (size: 48) ---


undefined4 __thiscall FUN_005b7e90(int param_1,int param_2)



{

  int iVar1;

  

  if (param_2 != 0) {

    iVar1 = FUN_005b7dd0(param_2,*(undefined4 *)(param_1 + 8));

    if (iVar1 != 0) {

      FUN_005b7740(iVar1 + 0x10);

      return 1;

    }

  }

  return 0;

}





// --- FUN_005b7ec0 at 0x005B7EC0 (size: 57) ---


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



{

  int iVar1;

  

  if (param_2 != 0) {

    iVar1 = FUN_005b7dd0(param_2,*(undefined4 *)(param_1 + 8));

    if ((iVar1 != 0) && (*(int *)(iVar1 + 4) != 0)) {

      FUN_005b7740(*(int *)(iVar1 + 4) + 0x10);

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

    }

  }

  return 0;

}





// --- FUN_005b7f00 at 0x005B7F00 (size: 57) ---


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



{

  int iVar1;

  

  if (param_2 != 0) {

    iVar1 = FUN_005b7dd0(param_2,*(undefined4 *)(param_1 + 8));

    if ((iVar1 != 0) && (*(int *)(iVar1 + 0xc) != 0)) {

      FUN_005b7740(*(int *)(iVar1 + 0xc) + 0x10);

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

    }

  }

  return 0;

}





// --- FUN_005b7f40 at 0x005B7F40 (size: 57) ---


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



{

  int iVar1;

  

  if (param_2 != 0) {

    iVar1 = FUN_005b7dd0(param_2,*(undefined4 *)(param_1 + 8));

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

      FUN_005b7740(*(int *)(iVar1 + 8) + 0x10);

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

    }

  }

  return 0;

}





// --- FUN_005b7f80 at 0x005B7F80 (size: 68) ---


bool __thiscall FUN_005b7f80(int param_1,int param_2,int param_3)



{

  undefined8 uVar1;

  

  if (param_2 == 0) {

    return false;

  }

  if (*(int *)(param_2 + 0x14) != param_3) {

    if (param_3 != 0) {

      uVar1 = FUN_005b7dd0(param_3,*(undefined4 *)(param_1 + 8));

      param_1 = (int)((ulonglong)uVar1 >> 0x20);

      if ((int)uVar1 != 0) {

        return false;

      }

    }

    return *(uint *)(param_1 + 0xc) < 0x9c41;

  }

  return false;

}





// --- FUN_005b7fd0 at 0x005B7FD0 (size: 179) ---


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



{

  undefined4 uVar1;

  int iVar2;

  int iVar3;

  longlong lVar4;

  

  if (*(uint *)(param_3 + 4) != 0) {

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

      if (param_2 == 0) {

        lVar4 = (ulonglong)*(uint *)(param_3 + 4) << 0x20;

      }

      else {

        lVar4 = FUN_005b7dd0(param_2,*(int *)(param_1 + 8));

      }

      iVar3 = (int)lVar4;

      iVar2 = FUN_005b7f80(lVar4);

      if (iVar2 != 0) {

        uVar1 = *(undefined4 *)(iVar3 + 0xc);

        iVar2 = FUN_005df0f5(0x48);

        if (iVar2 != 0) {

          iVar2 = FUN_005ba150(param_3);

          if (iVar2 != 0) {

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

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

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

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

            return 1;

          }

        }

      }

      return 0;

    }

    iVar2 = FUN_005df0f5(0x48);

    if (iVar2 == 0) {

      iVar2 = 0;

    }

    else {

      iVar2 = FUN_005ba150(param_3);

    }

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

    if (iVar2 != 0) {

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

      return 1;

    }

  }

  return 0;

}





// --- FUN_005b8090 at 0x005B8090 (size: 98) ---


uint FUN_005b8090(int param_1,int param_2)



{

  int iVar1;

  undefined4 uVar2;

  uint uVar3;

  uint uVar4;

  

  if (param_1 != 0) {

    uVar4 = 1;

    if (param_2 != 0) {

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

        uVar2 = 0;

      }

      else {

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

      }

      uVar4 = FUN_005b7fd0(uVar2,param_1 + 0x10);

    }

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

      uVar3 = FUN_005b8090(iVar1,1);

      uVar4 = uVar4 & uVar3;

    }

    return uVar4;

  }

  return 1;

}





// --- FUN_005b82b0 at 0x005B82B0 (size: 45) ---


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



{

  *param_1 = &PTR_FUN_0079385c;

  if (param_1[1] != 0) {

    FUN_004011e0(3);

  }

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

    operator_delete(param_1);

  }

  return param_1;

}





// --- FUN_005b82e0 at 0x005B82E0 (size: 195) ---


undefined4 __thiscall FUN_005b82e0(int *param_1,uint param_2)



{

  uint *puVar1;

  uint *puVar2;

  uint uVar3;

  

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

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

      return 1;

    }

    uVar3 = 0;

    if (param_2 == 0) {

      param_1[2] = 0;

      param_1[1] = 0;

      if (*param_1 != 0) {

        FUN_004011e0(3);

      }

      *param_1 = 0;

      return 1;

    }

    puVar2 = (uint *)thunk_FUN_005df0f5(param_2 * 4 + 4);

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

      puVar1 = puVar2 + 1;

      *puVar2 = param_2;

      FUN_00401000(puVar1,4,param_2,FUN_00411850);

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

        if (*param_1 != 0) {

          if (param_1[2] != 0) {

            do {

              FUN_0048a0a0(*param_1 + uVar3 * 4);

              uVar3 = uVar3 + 1;

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

          }

          if (*param_1 != 0) {

            FUN_004011e0(3);

          }

        }

        *param_1 = (int)puVar1;

        param_1[1] = param_2;

        return 1;

      }

    }

  }

  return 0;

}





// --- FUN_005b83b0 at 0x005B83B0 (size: 144) ---


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



{

  int *piVar1;

  undefined4 *puVar2;

  int iVar3;

  LONG LVar4;

  int *piVar5;

  int *piVar6;

  

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

    param_1[2] = 0;

    iVar3 = FUN_005b82e0(param_2[1]);

    if (iVar3 == 0) {

      return param_1;

    }

  }

  piVar5 = (int *)*param_1;

  piVar6 = (int *)*param_2;

  piVar1 = piVar6 + param_2[2];

  for (; piVar6 < piVar1; piVar6 = piVar6 + 1) {

    puVar2 = (undefined4 *)*piVar5;

    if (puVar2 != (undefined4 *)*piVar6) {

      LVar4 = InterlockedDecrement(puVar2 + 1);

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

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

      }

      iVar3 = *piVar6;

      *piVar5 = iVar3;

      InterlockedIncrement((LONG *)(iVar3 + 4));

    }

    piVar5 = piVar5 + 1;

  }

  param_1[2] = param_2[2];

  return param_1;

}





// --- FUN_005b84e0 at 0x005B84E0 (size: 111) ---


undefined4 FUN_005b84e0(int param_1,undefined4 param_2,int *param_3,int *param_4)



{

  undefined4 uVar1;

  int iVar2;

  

  if (param_1 == 0) {

    iVar2 = FUN_004fd1f0();

    *param_4 = *param_4 - iVar2;

    return 1;

  }

  if (param_1 != 1) {

    if (param_1 != 2) {

      return 0;

    }

    iVar2 = *param_3;

    uVar1 = FUN_004fd460(param_3,*param_4);

    *param_4 = *param_4 + (iVar2 - *param_3);

    return uVar1;

  }

  iVar2 = FUN_004fd290(param_3,*param_4);

  *param_4 = *param_4 - iVar2;

  return 1;

}





// --- FUN_005b8550 at 0x005B8550 (size: 264) ---


void __fastcall FUN_005b8550(int param_1)



{

  undefined4 *puVar1;

  LONG LVar2;

  LONG *pLVar3;

  

  FUN_005b7d10(param_1 + 8);

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

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

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

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

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

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

  if (puVar1 != DAT_008ef11c) {

    LVar2 = InterlockedDecrement(puVar1 + 1);

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

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

    }

    pLVar3 = DAT_008ef11c + 1;

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

    InterlockedIncrement(pLVar3);

  }

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

  if (puVar1 != DAT_008ef11c) {

    LVar2 = InterlockedDecrement(puVar1 + 1);

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

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

    }

    pLVar3 = DAT_008ef11c + 1;

    *(undefined4 **)(param_1 + 0x24) = DAT_008ef11c;

    InterlockedIncrement(pLVar3);

  }

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

  FUN_005870f0();

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

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

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

    FUN_004011e0(3);

  }

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

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

  if (puVar1 != DAT_008ef11c) {

    LVar2 = InterlockedDecrement(puVar1 + 1);

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

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

    }

    pLVar3 = DAT_008ef11c + 1;

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

    InterlockedIncrement(pLVar3);

  }

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

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

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

  return;

}





// --- FUN_005b8930 at 0x005B8930 (size: 402) ---


undefined4 * __fastcall FUN_005b8930(undefined4 *param_1)



{

  undefined4 *puVar1;

  LONG LVar2;

  LONG *pLVar3;

  

  *param_1 = &PTR_FUN_007e7e78;

  param_1[1] = 0;

  param_1[2] = 0;

  param_1[3] = 0;

  param_1[4] = 0;

  param_1[5] = 0;

  param_1[6] = 0;

  param_1[7] = 0;

  pLVar3 = DAT_008ef11c + 1;

  param_1[8] = DAT_008ef11c;

  InterlockedIncrement(pLVar3);

  pLVar3 = DAT_008ef11c + 1;

  param_1[9] = DAT_008ef11c;

  InterlockedIncrement(pLVar3);

  pLVar3 = DAT_008ef11c + 1;

  param_1[10] = DAT_008ef11c;

  InterlockedIncrement(pLVar3);

  param_1[0xb] = 0;

  param_1[0xc] = 0;

  param_1[0xd] = &PTR_FUN_0079da04;

  FUN_0046c1f0(0x17);

  param_1[0x2a] = &PTR_FUN_007cab80;

  param_1[0xd] = &PTR_FUN_007e7284;

  param_1[0x2a] = &PTR_LAB_007e726c;

  param_1[0x2c] = 0;

  param_1[0x2d] = 0;

  param_1[0x2e] = 0;

  param_1[0x2b] = &PTR_FUN_007e7e60;

  param_1[0x2f] = &PTR_LAB_00797910;

  param_1[0x30] = 0;

  param_1[0x31] = 0x3f800000;

  param_1[0x32] = 0;

  param_1[0x33] = 0;

  param_1[0x34] = 0;

  param_1[0x3e] = 0;

  param_1[0x3f] = 0;

  param_1[0x40] = 0;

  FUN_00535b30();

  param_1[0x41] = 0;

  param_1[0x42] = 0;

  puVar1 = (undefined4 *)param_1[8];

  if (puVar1 != DAT_008ef11c) {

    LVar2 = InterlockedDecrement(puVar1 + 1);

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

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

    }

    pLVar3 = DAT_008ef11c + 1;

    param_1[8] = DAT_008ef11c;

    InterlockedIncrement(pLVar3);

  }

  puVar1 = (undefined4 *)param_1[9];

  if (puVar1 != DAT_008ef11c) {

    LVar2 = InterlockedDecrement(puVar1 + 1);

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

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

    }

    pLVar3 = DAT_008ef11c + 1;

    param_1[9] = DAT_008ef11c;

    InterlockedIncrement(pLVar3);

  }

  puVar1 = (undefined4 *)param_1[10];

  if (puVar1 != DAT_008ef11c) {

    LVar2 = InterlockedDecrement(puVar1 + 1);

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

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

    }

    pLVar3 = DAT_008ef11c + 1;

    param_1[10] = DAT_008ef11c;

    InterlockedIncrement(pLVar3);

  }

  return param_1;

}





// --- FUN_005b8ad0 at 0x005B8AD0 (size: 290) ---


int __thiscall FUN_005b8ad0(int param_1,int param_2)



{

  undefined4 *puVar1;

  LONG LVar2;

  int iVar3;

  

  if (param_1 != param_2) {

    FUN_005b8550();

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

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

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

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

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

    if (puVar1 != *(undefined4 **)(param_2 + 0x20)) {

      LVar2 = InterlockedDecrement(puVar1 + 1);

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

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

      }

      iVar3 = *(int *)(param_2 + 0x20);

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

      InterlockedIncrement((LONG *)(iVar3 + 4));

    }

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

    if (puVar1 != *(undefined4 **)(param_2 + 0x24)) {

      LVar2 = InterlockedDecrement(puVar1 + 1);

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

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

      }

      iVar3 = *(int *)(param_2 + 0x24);

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

      InterlockedIncrement((LONG *)(iVar3 + 4));

    }

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

    FUN_005afbf0(param_2 + 0x34);

    if (param_2 == -0xac) {

      iVar3 = 0;

    }

    else {

      iVar3 = param_2 + 0xb0;

    }

    FUN_005b83b0(iVar3);

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

    if (puVar1 != *(undefined4 **)(param_2 + 0x28)) {

      LVar2 = InterlockedDecrement(puVar1 + 1);

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

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

      }

      iVar3 = *(int *)(param_2 + 0x28);

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

      InterlockedIncrement((LONG *)(iVar3 + 4));

    }

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

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

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

    FUN_005b8090(*(undefined4 *)(param_2 + 8),1);

  }

  return param_1;

}





// --- FUN_005b8c00 at 0x005B8C00 (size: 215) ---


void __fastcall FUN_005b8c00(undefined4 *param_1)



{

  undefined4 *puVar1;

  LONG LVar2;

  

  *param_1 = &PTR_FUN_007e7e78;

  FUN_005b8550();

  param_1[0x2f] = &PTR_FUN_0079385c;

  param_1[0x2b] = &PTR_FUN_0079385c;

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

    FUN_004011e0(3);

  }

  param_1[0x2a] = &PTR_LAB_007e726c;

  param_1[0x2a] = &PTR_FUN_0079385c;

  param_1[0xd] = &PTR_FUN_0079da04;

  FUN_005870f0();

  param_1[0xe] = &PTR_FUN_0079da00;

  if ((undefined4 *)param_1[0x26] != param_1 + 0xf) {

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

  }

  param_1[0x26] = 0;

  param_1[0x27] = 0;

  param_1[0x28] = 0;

  param_1[0x29] = 0;

  puVar1 = (undefined4 *)param_1[10];

  LVar2 = InterlockedDecrement(puVar1 + 1);

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

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

  }

  puVar1 = (undefined4 *)param_1[9];

  LVar2 = InterlockedDecrement(puVar1 + 1);

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

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

  }

  puVar1 = (undefined4 *)param_1[8];

  LVar2 = InterlockedDecrement(puVar1 + 1);

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

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

  }

  *param_1 = &PTR_FUN_0079385c;

  return;

}





// --- FUN_005b8ce0 at 0x005B8CE0 (size: 30) ---


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



{

  FUN_005b8c00();

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

    operator_delete(param_1);

  }

  return param_1;

}





// --- FUN_005b8d00 at 0x005B8D00 (size: 224) ---


undefined4 FUN_005b8d00(undefined4 param_1)



{

  switch(param_1) {

  case 1:

    FUN_004034c0("Yeoman");

    return 1;

  case 2:

    FUN_004034c0("Baronet");

    return 1;

  case 3:

    FUN_004034c0("Baron");

    return 1;

  case 4:

    FUN_004034c0("Reeve");

    return 1;

  case 5:

    FUN_004034c0("Thane");

    return 1;

  case 6:

    FUN_004034c0("Ealdor");

    return 1;

  case 7:

    FUN_004034c0(&DAT_007e7eb4);

    return 1;

  case 8:

    FUN_004034c0("Aetheling");

    return 1;

  case 9:

    FUN_004034c0(&DAT_007e7ea0);

    return 1;

  case 10:

    FUN_004034c0("High King");

    return 1;

  default:

    return 0;

  }

}





// --- FUN_005b8e10 at 0x005B8E10 (size: 224) ---


undefined4 FUN_005b8e10(undefined4 param_1)



{

  switch(param_1) {

  case 1:

    FUN_004034c0("Yeoman");

    return 1;

  case 2:

    FUN_004034c0("Baronet");

    return 1;

  case 3:

    FUN_004034c0("Baroness");

    return 1;

  case 4:

    FUN_004034c0("Reeve");

    return 1;

  case 5:

    FUN_004034c0("Thane");

    return 1;

  case 6:

    FUN_004034c0("Ealdor");

    return 1;

  case 7:

    FUN_004034c0("Duchess");

    return 1;

  case 8:

    FUN_004034c0("Aetheling");

    return 1;

  case 9:

    FUN_004034c0("Queen");

    return 1;

  case 10:

    FUN_004034c0("High Queen");

    return 1;

  default:

    return 0;

  }

}





// --- FUN_005b8f20 at 0x005B8F20 (size: 224) ---


undefined4 FUN_005b8f20(undefined4 param_1)



{

  switch(param_1) {

  case 1:

    FUN_004034c0("Sayyid");

    return 1;

  case 2:

    FUN_004034c0("Shayk");

    return 1;

  case 3:

    FUN_004034c0("Maulan");

    return 1;

  case 4:

    FUN_004034c0("Mu\'allim");

    return 1;

  case 5:

    FUN_004034c0("Naquib");

    return 1;

  case 6:

    FUN_004034c0(&DAT_007e7f34);

    return 1;

  case 7:

    FUN_004034c0("Mushir");

    return 1;

  case 8:

    FUN_004034c0(&DAT_007e7f24);

    return 1;

  case 9:

    FUN_004034c0("Malik");

    return 1;

  case 10:

    FUN_004034c0("Sultan");

    return 1;

  default:

    return 0;

  }

}





// --- FUN_005b9030 at 0x005B9030 (size: 224) ---


undefined4 FUN_005b9030(undefined4 param_1)



{

  switch(param_1) {

  case 1:

    FUN_004034c0("Sayyida");

    return 1;

  case 2:

    FUN_004034c0("Shayka");

    return 1;

  case 3:

    FUN_004034c0("Maulana");

    return 1;

  case 4:

    FUN_004034c0("Mu\'allima");

    return 1;

  case 5:

    FUN_004034c0("Naquiba");

    return 1;

  case 6:

    FUN_004034c0("Qadiya");

    return 1;

  case 7:

    FUN_004034c0("Mushira");

    return 1;

  case 8:

    FUN_004034c0("Amira");

    return 1;

  case 9:

    FUN_004034c0("Malika");

    return 1;

  case 10:

    FUN_004034c0("Sultana");

    return 1;

  default:

    return 0;

  }

}





// --- FUN_005b9140 at 0x005B9140 (size: 224) ---


undefined4 FUN_005b9140(undefined4 param_1)



{

  switch(param_1) {

  case 1:

    FUN_004034c0("Jinin");

    return 1;

  case 2:

    FUN_004034c0("Jo-chueh");

    return 1;

  case 3:

    FUN_004034c0("Nan-chueh");

    return 1;

  case 4:

    FUN_004034c0("Shi-chueh");

    return 1;

  case 5:

    FUN_004034c0("Ta-chueh");

    return 1;

  case 6:

    FUN_004034c0("Kun-chueh");

    return 1;

  case 7:

    FUN_004034c0(&DAT_007e7fd0);

    return 1;

  case 8:

    FUN_004034c0("Taikou");

    return 1;

  case 9:

    FUN_004034c0(&DAT_007e7fc4);

    return 1;

  case 10:

    FUN_004034c0("Koutei");

    return 1;

  default:

    return 0;

  }

}





// --- FUN_005b9250 at 0x005B9250 (size: 224) ---


undefined4 FUN_005b9250(undefined4 param_1)



{

  switch(param_1) {

  case 1:

    FUN_004034c0("Jinin");

    return 1;

  case 2:

    FUN_004034c0("Jo-chueh");

    return 1;

  case 3:

    FUN_004034c0("Nan-chueh");

    return 1;

  case 4:

    FUN_004034c0("Shi-chueh");

    return 1;

  case 5:

    FUN_004034c0("Ta-chueh");

    return 1;

  case 6:

    FUN_004034c0("Kun-chueh");

    return 1;

  case 7:

    FUN_004034c0(&DAT_007e7fd0);

    return 1;

  case 8:

    FUN_004034c0("Taikou");

    return 1;

  case 9:

    FUN_004034c0("Jo-ou");

    return 1;

  case 10:

    FUN_004034c0("Koutei");

    return 1;

  default:

    return 0;

  }

}





// --- FUN_005b9360 at 0x005B9360 (size: 224) ---


undefined4 FUN_005b9360(undefined4 param_1)



{

  switch(param_1) {

  case 1:

    FUN_004034c0("Squire");

    return 1;

  case 2:

    FUN_004034c0("Banner");

    return 1;

  case 3:

    FUN_004034c0("Baron");

    return 1;

  case 4:

    FUN_004034c0("Viscount");

    return 1;

  case 5:

    FUN_004034c0("Count");

    return 1;

  case 6:

    FUN_004034c0("Marquis");

    return 1;

  case 7:

    FUN_004034c0(&DAT_007e7eb4);

    return 1;

  case 8:

    FUN_004034c0("Grand Duke");

    return 1;

  case 9:

    FUN_004034c0(&DAT_007e7ea0);

    return 1;

  case 10:

    FUN_004034c0("High King");

    return 1;

  default:

    return 0;

  }

}





// --- FUN_005b9470 at 0x005B9470 (size: 224) ---


undefined4 FUN_005b9470(undefined4 param_1)



{

  switch(param_1) {

  case 1:

    FUN_004034c0(&DAT_007e808c);

    return 1;

  case 2:

    FUN_004034c0("Banner");

    return 1;

  case 3:

    FUN_004034c0("Baroness");

    return 1;

  case 4:

    FUN_004034c0("Viscountess");

    return 1;

  case 5:

    FUN_004034c0("Countess");

    return 1;

  case 6:

    FUN_004034c0("Marquise");

    return 1;

  case 7:

    FUN_004034c0("Duchess");

    return 1;

  case 8:

    FUN_004034c0("Grand Duchess");

    return 1;

  case 9:

    FUN_004034c0("Queen");

    return 1;

  case 10:

    FUN_004034c0("High Queen");

    return 1;

  default:

    return 0;

  }

}





// --- FUN_005b9580 at 0x005B9580 (size: 224) ---


undefined4 FUN_005b9580(undefined4 param_1)



{

  switch(param_1) {

  case 1:

    FUN_004034c0("Tenebrous");

    return 1;

  case 2:

    FUN_004034c0("Shade");

    return 1;

  case 3:

    FUN_004034c0("Squire");

    return 1;

  case 4:

    FUN_004034c0("Knight");

    return 1;

  case 5:

    FUN_004034c0("Void Knight");

    return 1;

  case 6:

    FUN_004034c0("Void Lord");

    return 1;

  case 7:

    FUN_004034c0(&DAT_007e7eb4);

    return 1;

  case 8:

    FUN_004034c0("Archduke");

    return 1;

  case 9:

    FUN_004034c0("Highborn");

    return 1;

  case 10:

    FUN_004034c0(&DAT_007e7ea0);

    return 1;

  default:

    return 0;

  }

}





// --- FUN_005b9690 at 0x005B9690 (size: 224) ---


undefined4 FUN_005b9690(undefined4 param_1)



{

  switch(param_1) {

  case 1:

    FUN_004034c0("Tenebrous");

    return 1;

  case 2:

    FUN_004034c0("Shade");

    return 1;

  case 3:

    FUN_004034c0("Squire");

    return 1;

  case 4:

    FUN_004034c0("Knight");

    return 1;

  case 5:

    FUN_004034c0("Void Knight");

    return 1;

  case 6:

    FUN_004034c0("Void Lady");

    return 1;

  case 7:

    FUN_004034c0("Duchess");

    return 1;

  case 8:

    FUN_004034c0("Archduchess");

    return 1;

  case 9:

    FUN_004034c0("Highborn");

    return 1;

  case 10:

    FUN_004034c0("Queen");

    return 1;

  default:

    return 0;

  }

}





// --- FUN_005b97a0 at 0x005B97A0 (size: 224) ---


undefined4 FUN_005b97a0(undefined4 param_1)



{

  switch(param_1) {

  case 1:

    FUN_004034c0("Tribunus");

    return 1;

  case 2:

    FUN_004034c0("Praefectus");

    return 1;

  case 3:

    FUN_004034c0("Optio");

    return 1;

  case 4:

    FUN_004034c0("Centurion");

    return 1;

  case 5:

    FUN_004034c0("Principes");

    return 1;

  case 6:

    FUN_004034c0("Legatus");

    return 1;

  case 7:

    FUN_004034c0("Consul");

    return 1;

  case 8:

    FUN_004034c0(&DAT_007e810c);

    return 1;

  case 9:

    FUN_004034c0("Secondus");

    return 1;

  case 10:

    FUN_004034c0("Primus");

    return 1;

  default:

    return 0;

  }

}





// --- FUN_005b98b0 at 0x005B98B0 (size: 224) ---


undefined4 FUN_005b98b0(undefined4 param_1)



{

  switch(param_1) {

  case 1:

    FUN_004034c0("Xutua");

    return 1;

  case 2:

    FUN_004034c0("Tuona");

    return 1;

  case 3:

    FUN_004034c0(&DAT_007e8188);

    return 1;

  case 4:

    FUN_004034c0("Nuona");

    return 1;

  case 5:

    FUN_004034c0("Turea");

    return 1;

  case 6:

    FUN_004034c0(&DAT_007e8174);

    return 1;

  case 7:

    FUN_004034c0("Nurea");

    return 1;

  case 8:

    FUN_004034c0(&DAT_007e8164);

    return 1;

  case 9:

    FUN_004034c0("Sutah");

    return 1;

  case 10:

    FUN_004034c0(&DAT_007e8158);

    return 1;

  default:

    return 0;

  }

}





// --- FUN_005b99c0 at 0x005B99C0 (size: 224) ---


undefined4 FUN_005b99c0(undefined4 param_1)



{

  switch(param_1) {

  case 1:

    FUN_004034c0("Laigus");

    return 1;

  case 2:

    FUN_004034c0("Raigus");

    return 1;

  case 3:

    FUN_004034c0("Amploth");

    return 1;

  case 4:

    FUN_004034c0("Arintoth");

    return 1;

  case 5:

    FUN_004034c0("Obeloth");

    return 1;

  case 6:

    FUN_004034c0("Lithos");

    return 1;

  case 7:

    FUN_004034c0("Kantos");

    return 1;

  case 8:

    FUN_004034c0("Gigas");

    return 1;

  case 9:

    FUN_004034c0("Extas");

    return 1;

  case 10:

    FUN_004034c0("Tiatus");

    return 1;

  default:

    return 0;

  }

}





// --- FUN_005b9ad0 at 0x005B9AD0 (size: 224) ---


undefined4 FUN_005b9ad0(undefined4 param_1)



{

  switch(param_1) {

  case 1:

    FUN_004034c0("Ensign");

    return 1;

  case 2:

    FUN_004034c0("Corporal");

    return 1;

  case 3:

    FUN_004034c0("Lieutenant");

    return 1;

  case 4:

    FUN_004034c0("Commander");

    return 1;

  case 5:

    FUN_004034c0("Captain");

    return 1;

  case 6:

    FUN_004034c0("Commodore");

    return 1;

  case 7:

    FUN_004034c0("Admiral");

    return 1;

  case 8:

    FUN_004034c0("Warlord");

    return 1;

  case 9:

    FUN_004034c0("Ipharsin");

    return 1;

  case 10:

    FUN_004034c0("Aulin");

    return 1;

  default:

    return 0;

  }

}





// --- FUN_005b9be0 at 0x005B9BE0 (size: 224) ---


undefined4 FUN_005b9be0(undefined4 param_1)



{

  switch(param_1) {

  case 1:

    FUN_004034c0("Ensign");

    return 1;

  case 2:

    FUN_004034c0("Corporal");

    return 1;

  case 3:

    FUN_004034c0("Lieutenant");

    return 1;

  case 4:

    FUN_004034c0("Commander");

    return 1;

  case 5:

    FUN_004034c0("Captain");

    return 1;

  case 6:

    FUN_004034c0("Commodore");

    return 1;

  case 7:

    FUN_004034c0("Admiral");

    return 1;

  case 8:

    FUN_004034c0("Warlord");

    return 1;

  case 9:

    FUN_004034c0("Ipharsia");

    return 1;

  case 10:

    FUN_004034c0("Aulia");

    return 1;

  default:

    return 0;

  }

}





// --- FUN_005b9cf0 at 0x005B9CF0 (size: 224) ---


undefined4 FUN_005b9cf0(undefined4 param_1)



{

  switch(param_1) {

  case 1:

    FUN_004034c0("Neophyte");

    return 1;

  case 2:

    FUN_004034c0("Acolyte");

    return 1;

  case 3:

    FUN_004034c0("Adept");

    return 1;

  case 4:

    FUN_004034c0("Esquire");

    return 1;

  case 5:

    FUN_004034c0("Squire");

    return 1;

  case 6:

    FUN_004034c0("Knight");

    return 1;

  case 7:

    FUN_004034c0("Count");

    return 1;

  case 8:

    FUN_004034c0("Viscount");

    return 1;

  case 9:

    FUN_004034c0("Highness");

    return 1;

  case 10:

    FUN_004034c0("Annointed");

    return 1;

  default:

    return 0;

  }

}





// --- FUN_005b9e00 at 0x005B9E00 (size: 224) ---


undefined4 FUN_005b9e00(undefined4 param_1)



{

  switch(param_1) {

  case 1:

    FUN_004034c0("Neophyte");

    return 1;

  case 2:

    FUN_004034c0("Acolyte");

    return 1;

  case 3:

    FUN_004034c0("Adept");

    return 1;

  case 4:

    FUN_004034c0("Esquire");

    return 1;

  case 5:

    FUN_004034c0("Squire");

    return 1;

  case 6:

    FUN_004034c0("Knight");

    return 1;

  case 7:

    FUN_004034c0("Countess");

    return 1;

  case 8:

    FUN_004034c0("Viscountess");

    return 1;

  case 9:

    FUN_004034c0("Highness");

    return 1;

  case 10:

    FUN_004034c0("Annointed");

    return 1;

  default:

    return 0;

  }

}





// --- FUN_005b9f10 at 0x005B9F10 (size: 443) ---


undefined4 FUN_005b9f10(undefined4 param_1,undefined4 param_2,int param_3,undefined4 param_4)



{

  undefined4 uVar1;

  

  if (param_3 == 1) {

    switch(param_2) {

    case 1:

      uVar1 = FUN_005b8d00(param_1,param_4);

      return uVar1;

    case 2:

      uVar1 = FUN_005b8f20(param_1,param_4);

      return uVar1;

    case 3:

      uVar1 = FUN_005b9140(param_1,param_4);

      return uVar1;

    case 4:

      uVar1 = FUN_005b9360(param_1,param_4);

      return uVar1;

    case 5:

    case 10:

      uVar1 = FUN_005b9580(param_1,param_4);

      return uVar1;

    case 6:

      uVar1 = FUN_005b97a0(param_1,param_4);

      return uVar1;

    case 7:

      uVar1 = FUN_005b98b0(param_1,param_4);

      return uVar1;

    case 8:

      uVar1 = FUN_005b99c0(param_1,param_4);

      return uVar1;

    case 9:

      uVar1 = FUN_005b9ad0(param_1,param_4);

      return uVar1;

    case 0xb:

      uVar1 = FUN_005b9cf0(param_1,param_4);

      return uVar1;

    }

  }

  else if (param_3 == 2) {

    switch(param_2) {

    case 1:

      uVar1 = FUN_005b8e10(param_1,param_4);

      return uVar1;

    case 2:

      uVar1 = FUN_005b9030(param_1,param_4);

      return uVar1;

    case 3:

      uVar1 = FUN_005b9250(param_1,param_4);

      return uVar1;

    case 4:

      uVar1 = FUN_005b9470(param_1,param_4);

      return uVar1;

    case 5:

    case 10:

      uVar1 = FUN_005b9690(param_1,param_4);

      return uVar1;

    case 6:

      uVar1 = FUN_005b97a0(param_1,param_4);

      return uVar1;

    case 7:

      uVar1 = FUN_005b98b0(param_1,param_4);

      return uVar1;

    case 8:

      uVar1 = FUN_005b99c0(param_1,param_4);

      return uVar1;

    case 9:

      uVar1 = FUN_005b9be0(param_1,param_4);

      return uVar1;

    case 0xb:

      uVar1 = FUN_005b9e00(param_1,param_4);

      return uVar1;

    }

  }

  return 0;

}





// --- FUN_005ba150 at 0x005BA150 (size: 39) ---


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



{

  param_1[1] = 0;

  param_1[2] = 0;

  param_1[3] = 0;

  *param_1 = &PTR_FUN_007e82a4;

  FUN_005b78e0(param_2);

  return param_1;

}





// --- FUN_005ba180 at 0x005BA180 (size: 45) ---


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



{

  *param_1 = &PTR_FUN_007e82a4;

  FUN_005b76c0();

  *param_1 = &PTR_FUN_0079385c;

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

    operator_delete(param_1);

  }

  return param_1;

}





// --- FUN_005ba1b0 at 0x005BA1B0 (size: 8) ---


bool __fastcall FUN_005ba1b0(int param_1)



{

  return 8 < *(uint *)(param_1 + 0x14);

}





// --- FUN_005ba1c0 at 0x005BA1C0 (size: 77) ---


bool __thiscall FUN_005ba1c0(int param_1,uint param_2)



{

  uint *puVar1;

  

  if ((*(uint *)(param_1 + 0x10) != 0) && (*(int *)(param_1 + 0xc) != 0)) {

    for (puVar1 = *(uint **)(*(int *)(param_1 + 0xc) + (param_2 % *(uint *)(param_1 + 0x10)) * 4);

        puVar1 != (uint *)0x0; puVar1 = (uint *)puVar1[0xd]) {

      if (param_2 == *puVar1) {

        return puVar1 != (uint *)0xfffffffc;

      }

    }

  }

  return false;

}





// --- FUN_005ba210 at 0x005BA210 (size: 85) ---


undefined4 __thiscall FUN_005ba210(int param_1,uint param_2)



{

  uint *puVar1;

  

  if ((*(uint *)(param_1 + 0x10) != 0) && (*(int *)(param_1 + 0xc) != 0)) {

    puVar1 = *(uint **)(*(int *)(param_1 + 0xc) + (param_2 % *(uint *)(param_1 + 0x10)) * 4);

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

      while (param_2 != *puVar1) {

        puVar1 = (uint *)puVar1[0xd];

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

          return 0;

        }

      }

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

        FUN_005baaa0(puVar1 + 1);

        return 1;

      }

    }

  }

  return 0;

}





// --- FUN_005ba270 at 0x005BA270 (size: 16) ---


int __fastcall FUN_005ba270(int param_1)



{

  uint uVar1;

  int iVar2;

  int iVar3;

  int iVar4;

  undefined1 auStack_10 [4];

  int iStack_c;

  int iStack_8;

  uint uStack_4;

  

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

    return 0;

  }

  iVar3 = 0;

  FUN_0048ecc0(auStack_10);

LAB_005ba2a0:

  do {

    do {

      iVar4 = iStack_c;

      if (iVar4 == 0) {

        return iVar3;

      }

      iVar2 = FUN_005bacc0(*(undefined4 *)(iVar4 + 0xc));

      iVar3 = iVar3 + iVar2;

      iStack_c = *(int *)(iVar4 + 0x34);

    } while (*(int *)(iVar4 + 0x34) != 0);

    uVar1 = *(uint *)(iVar4 + 0x38);

    do {

      uVar1 = uVar1 + 1;

      if (uStack_4 <= uVar1) {

        iStack_c = 0;

        goto LAB_005ba2a0;

      }

    } while (*(int *)(iStack_8 + uVar1 * 4) == 0);

    iStack_c = *(int *)(iStack_8 + uVar1 * 4);

  } while( true );

}





// --- FUN_005ba280 at 0x005BA280 (size: 103) ---


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



{

  uint uVar1;

  int iVar2;

  int iVar3;

  int iVar4;

  

  iVar3 = 0;

  FUN_0048ecc0(&stack0x00000000);

LAB_005ba2a0:

  do {

    do {

      iVar4 = param_1;

      if (iVar4 == 0) {

        return iVar3;

      }

      iVar2 = FUN_005bacc0(*(undefined4 *)(iVar4 + 0xc));

      iVar3 = iVar3 + iVar2;

      param_1 = *(int *)(iVar4 + 0x34);

    } while (*(int *)(iVar4 + 0x34) != 0);

    uVar1 = *(uint *)(iVar4 + 0x38);

    do {

      uVar1 = uVar1 + 1;

      if (param_3 <= uVar1) {

        param_1 = 0;

        goto LAB_005ba2a0;

      }

    } while (*(int *)(param_2 + uVar1 * 4) == 0);

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

  } while( true );

}





// --- FUN_005ba2f0 at 0x005BA2F0 (size: 68) ---


uint __fastcall FUN_005ba2f0(int param_1)



{

  uint *puVar1;

  

  if (((*(uint *)(param_1 + 0x10) != 0) && (*(int *)(param_1 + 0xc) != 0)) &&

     (puVar1 = *(uint **)(*(int *)(param_1 + 0xc) +

                         (*(uint *)(param_1 + 0x1c) % *(uint *)(param_1 + 0x10)) * 4),

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

    while (*(uint *)(param_1 + 0x1c) != *puVar1) {

      puVar1 = (uint *)puVar1[0xd];

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

        return 0xffffffff;

      }

    }

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

      return puVar1[3];

    }

  }

  return 0xffffffff;

}





// --- FUN_005ba340 at 0x005BA340 (size: 100) ---


int __fastcall FUN_005ba340(int param_1)



{

  uint uVar1;

  int *piVar2;

  undefined1 local_10 [4];

  int *local_c;

  int local_8;

  uint local_4;

  

  FUN_0048ecc0(local_10);

LAB_005ba360:

  do {

    do {

      piVar2 = local_c;

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

        return 0;

      }

      if (*(int *)(param_1 + 0x1c) != *piVar2) {

        return *piVar2;

      }

      local_c = (int *)piVar2[0xd];

    } while ((int *)piVar2[0xd] != (int *)0x0);

    uVar1 = piVar2[0xe];

    do {

      uVar1 = uVar1 + 1;

      if (local_4 <= uVar1) {

        local_c = (int *)0x0;

        goto LAB_005ba360;

      }

    } while (*(int *)(local_8 + uVar1 * 4) == 0);

    local_c = *(int **)(local_8 + uVar1 * 4);

  } while( true );

}





// --- FUN_005ba3b0 at 0x005BA3B0 (size: 107) ---


void __fastcall FUN_005ba3b0(int param_1)



{

  int iVar1;

  int local_4;

  

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

    local_4 = param_1;

    iVar1 = FUN_005d5760(&stack0x00000004);

    if (iVar1 == 0) {

      local_4 = FUN_0040fa90();

      FUN_0052dfd0(&stack0x00000004,&local_4);

      return;

    }

    FUN_00590a50(&stack0x00000004,&local_4);

    local_4 = FUN_0040fa90();

    FUN_0052dfd0(&stack0x00000004,&local_4);

  }

  return;

}





// --- FUN_005ba420 at 0x005BA420 (size: 181) ---


void __fastcall FUN_005ba420(int param_1)



{

  uint uVar1;

  uint uVar2;

  int iVar3;

  uint uVar4;

  uint local_14;

  undefined1 local_10 [4];

  int local_c;

  int local_8;

  uint local_4;

  

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

    uVar2 = FUN_005ba2f0();

    uVar4 = 100000;

    local_14 = 0;

    FUN_0048ecc0(local_10);

LAB_005ba461:

    iVar3 = local_c;

    if (iVar3 != 0) {

      uVar1 = *(uint *)(iVar3 + 0xc);

      if (uVar1 < uVar4) {

        uVar4 = uVar1;

      }

      if (local_14 < uVar1) {

        local_14 = uVar1;

      }

      local_c = *(int *)(iVar3 + 0x34);

      if (*(int *)(iVar3 + 0x34) == 0) {

        uVar1 = *(uint *)(iVar3 + 0x38);

        do {

          uVar1 = uVar1 + 1;

          if (local_4 <= uVar1) {

            local_c = 0;

            goto LAB_005ba461;

          }

        } while (*(int *)(local_8 + uVar1 * 4) == 0);

        local_c = *(int *)(local_8 + uVar1 * 4);

      }

      goto LAB_005ba461;

    }

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

    if (uVar4 < 0x32) {

      if (uVar2 + 5 < local_14) {

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

      }

      if (uVar4 + 5 < uVar2) {

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

      }

    }

  }

  return;

}





// --- FUN_005ba5c0 at 0x005BA5C0 (size: 101) ---


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



{

  int *piVar1;

  int iVar2;

  undefined4 local_4;

  

  local_4 = param_2;

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

    piVar1 = (int *)FUN_005d5760(&local_4);

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

      return 0;

    }

    iVar2 = FUN_0040fa90();

    if (900 < iVar2 - *piVar1) {

      return 0;

    }

  }

  iVar2 = FUN_0056a530(&param_2,param_3);

  if (iVar2 == 0) {

    return 0;

  }

  FUN_005ba420();

  return 1;

}





// --- FUN_005ba630 at 0x005BA630 (size: 246) ---


bool __thiscall FUN_005ba630(int *param_1,int *param_2,uint param_3)



{

  uint uVar1;

  int iVar2;

  int iVar3;

  

  uVar1 = (**(code **)(*param_1 + 8))();

  if (param_3 < uVar1) {

    return false;

  }

  iVar3 = *param_2;

  iVar2 = (**(code **)(param_1[1] + 0x10))(param_2,param_3);

  if (iVar2 != 0) {

    uVar1 = *param_2 - iVar3;

    if (uVar1 < param_3) {

      iVar2 = param_3 - uVar1;

    }

    else {

      iVar2 = 0;

    }

    iVar2 = FUN_004fd460(param_2,iVar2);

    if (iVar2 != 0) {

      uVar1 = *param_2 - iVar3;

      if ((uVar1 < param_3) && (param_3 = param_3 - uVar1, 3 < param_3)) {

        param_1[7] = *(int *)*param_2;

        *param_2 = *param_2 + 4;

        iVar3 = FUN_004fd180(param_1 + 8,param_2,&stack0x00000000);

        if (iVar3 != 0) {

          iVar3 = FUN_004fd180(param_1 + 9,param_2,&stack0x00000000);

          if (iVar3 != 0) {

            iVar3 = FUN_004fd180(param_1 + 10,param_2,&stack0x00000000);

            if (iVar3 != 0) {

              iVar3 = FUN_004fd180(param_1 + 0xb,param_2,&stack0x00000000);

              if (iVar3 != 0) {

                iVar3 = (**(code **)(param_1[0xc] + 0x10))(param_2,param_3 - 4);

                return iVar3 != 0;

              }

            }

          }

        }

      }

    }

  }

  return false;

}





// --- FUN_005ba730 at 0x005BA730 (size: 137) ---


undefined4 __thiscall FUN_005ba730(int param_1,uint *param_2)



{

  uint *puVar1;

  uint *puVar2;

  

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

    puVar1 = (uint *)0x0;

    for (puVar2 = *(uint **)(*(int *)(param_1 + 8) + (*param_2 % *(uint *)(param_1 + 0xc)) * 4);

        puVar2 != (uint *)0x0; puVar2 = (uint *)puVar2[0xd]) {

      if (*puVar2 == *param_2) {

        FUN_005baaa0(puVar2 + 1);

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

          *(uint *)(*(int *)(param_1 + 8) + (*param_2 % *(uint *)(param_1 + 0xc)) * 4) = puVar2[0xd]

          ;

        }

        else {

          puVar1[0xd] = puVar2[0xd];

        }

        FUN_0056a650(1);

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

        return 1;

      }

      puVar1 = puVar2;

    }

  }

  return 0;

}





// --- FUN_005ba7c0 at 0x005BA7C0 (size: 166) ---


undefined4 FUN_005ba7c0(undefined4 param_1)



{

  undefined4 uVar1;

  int iVar2;

  LONG LVar3;

  undefined **local_30;

  undefined4 *local_2c;

  

  uVar1 = param_1;

  FUN_005ba3b0(param_1);

  FUN_005ba9e0();

  param_1 = uVar1;

  FUN_005ba3b0(uVar1);

  iVar2 = FUN_005ba730(&param_1,&local_30);

  if (iVar2 == 0) {

    local_30 = &PTR_FUN_007a61ac;

    LVar3 = InterlockedDecrement(local_2c + 1);

    if ((LVar3 == 0) && (local_2c != (undefined4 *)0x0)) {

      (**(code **)*local_2c)(1);

    }

    return 0;

  }

  FUN_005ba420();

  local_30 = &PTR_FUN_007a61ac;

  LVar3 = InterlockedDecrement(local_2c + 1);

  if ((LVar3 == 0) && (local_2c != (undefined4 *)0x0)) {

    (**(code **)*local_2c)(1);

  }

  return 1;

}





// --- FUN_005ba870 at 0x005BA870 (size: 101) ---


undefined4 __thiscall FUN_005ba870(int param_1,uint param_2,undefined4 param_3)



{

  uint *puVar1;

  undefined4 uVar2;

  

  if ((*(uint *)(param_1 + 0x10) != 0) && (*(int *)(param_1 + 0xc) != 0)) {

    for (puVar1 = *(uint **)(*(int *)(param_1 + 0xc) + (param_2 % *(uint *)(param_1 + 0x10)) * 4);

        puVar1 != (uint *)0x0; puVar1 = (uint *)puVar1[0xd]) {

      if (param_2 == *puVar1) {

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

          FUN_005baaa0(param_3);

          FUN_005ba420();

          return 1;

        }

        break;

      }

    }

  }

  uVar2 = FUN_005ba5c0(param_2,param_3);

  return uVar2;

}





// --- FUN_005ba8e0 at 0x005BA8E0 (size: 116) ---


undefined4 * __fastcall FUN_005ba8e0(undefined4 *param_1)



{

  LONG *lpAddend;

  

  *param_1 = &PTR_FUN_007e6214;

  param_1[1] = &PTR_FUN_007cfc78;

  param_1[2] = 0;

  param_1[3] = 0;

  param_1[4] = 0x10;

  param_1[5] = 0;

  FUN_005a8440();

  lpAddend = (LONG *)(DAT_008ef11c + 4);

  param_1[6] = DAT_008ef11c;

  InterlockedIncrement(lpAddend);

  param_1[7] = 0;

  param_1[8] = 1;

  param_1[9] = 0;

  param_1[10] = 0;

  param_1[0xb] = 0;

  param_1[0xc] = &PTR_FUN_007cfc64;

  param_1[0xd] = 0;

  param_1[0xe] = 0;

  param_1[0xf] = 0x20;

  param_1[0x10] = 0;

  FUN_005a8440();

  return param_1;

}





// --- FUN_005ba960 at 0x005BA960 (size: 125) ---


int __thiscall FUN_005ba960(int param_1,int param_2)



{

  undefined4 *puVar1;

  int iVar2;

  LONG LVar3;

  

  if (param_1 != param_2) {

    FUN_0056a9c0(param_2 + 4);

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

    if (puVar1 != *(undefined4 **)(param_2 + 0x18)) {

      LVar3 = InterlockedDecrement(puVar1 + 1);

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

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

      }

      iVar2 = *(int *)(param_2 + 0x18);

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

      InterlockedIncrement((LONG *)(iVar2 + 4));

    }

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

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

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

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

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

    FUN_0056a5d0(param_2 + 0x30);

  }

  return param_1;

}





// --- FUN_005ba9e0 at 0x005BA9E0 (size: 65) ---


undefined4 * __fastcall FUN_005ba9e0(undefined4 *param_1)



{

  LONG *lpAddend;

  

  *param_1 = &PTR_FUN_007a61ac;

  lpAddend = (LONG *)(DAT_008ef11c + 4);

  param_1[1] = DAT_008ef11c;

  InterlockedIncrement(lpAddend);

  param_1[2] = 0;

  param_1[3] = 0;

  param_1[4] = 0;

  param_1[5] = 0;

  param_1[6] = 0;

  param_1[7] = 0;

  param_1[8] = 0;

  param_1[9] = 0;

  param_1[10] = 0;

  param_1[0xb] = 0;

  return param_1;

}





// --- FUN_005baa30 at 0x005BAA30 (size: 97) ---


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



{

  int iVar1;

  

  *param_1 = &PTR_FUN_007a61ac;

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

  param_1[1] = iVar1;

  InterlockedIncrement((LONG *)(iVar1 + 4));

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

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

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

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

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

  param_1[7] = *(undefined4 *)(param_2 + 0x1c);

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

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

  param_1[10] = *(undefined4 *)(param_2 + 0x28);

  param_1[0xb] = *(undefined4 *)(param_2 + 0x2c);

  return param_1;

}





// --- FUN_005baaa0 at 0x005BAAA0 (size: 133) ---


int __thiscall FUN_005baaa0(int param_1,int param_2)



{

  undefined4 *puVar1;

  int iVar2;

  LONG LVar3;

  

  if (param_1 != param_2) {

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

    if (puVar1 != *(undefined4 **)(param_2 + 4)) {

      LVar3 = InterlockedDecrement(puVar1 + 1);

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

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

      }

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

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

      InterlockedIncrement((LONG *)(iVar2 + 4));

    }

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

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

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

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

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

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

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

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

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

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

  }

  return param_1;

}





// --- FUN_005bab50 at 0x005BAB50 (size: 178) ---


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



{

  int iVar1;

  uint uVar2;

  

  uVar2 = (**(code **)(*param_1 + 8))();

  if (uVar2 <= param_3) {

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

    iVar1 = *param_2;

    *param_2 = iVar1 + 4;

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

    iVar1 = *param_2;

    *param_2 = iVar1 + 4;

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

    iVar1 = *param_2;

    *param_2 = iVar1 + 4;

    *(int *)(iVar1 + 4) = param_1[6];

    iVar1 = *param_2;

    *param_2 = iVar1 + 4;

    *(int *)(iVar1 + 4) = param_1[7];

    iVar1 = *param_2;

    *param_2 = iVar1 + 4;

    *(int *)(iVar1 + 4) = param_1[8];

    iVar1 = *param_2;

    *param_2 = iVar1 + 4;

    *(int *)(iVar1 + 4) = param_1[9];

    iVar1 = *param_2;

    *param_2 = iVar1 + 4;

    *(int *)(iVar1 + 4) = param_1[10];

    iVar1 = *param_2;

    *param_2 = iVar1 + 4;

    *(int *)(iVar1 + 4) = param_1[0xb];

    iVar1 = *param_2;

    *param_2 = iVar1 + 4;

    *(int *)(iVar1 + 4) = param_1[5];

    *param_2 = *param_2 + 4;

    FUN_004fd290(param_2,param_3);

  }

  return uVar2;

}





// --- FUN_005bac10 at 0x005BAC10 (size: 165) ---


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



{

  int iVar1;

  undefined4 uVar2;

  

  if (param_3 < 0x28) {

    return 0;

  }

  uVar2 = *(undefined4 *)*param_2;

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

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

  uVar2 = *(undefined4 *)*param_2;

  *param_2 = (int)((undefined4 *)*param_2 + 1);

  *(undefined4 *)(param_1 + 0x10) = uVar2;

  uVar2 = *(undefined4 *)*param_2;

  *param_2 = (int)((undefined4 *)*param_2 + 1);

  *(undefined4 *)(param_1 + 8) = uVar2;

  *(undefined4 *)(param_1 + 0x18) = *(undefined4 *)*param_2;

  iVar1 = *param_2;

  *param_2 = iVar1 + 4;

  *(undefined4 *)(param_1 + 0x1c) = *(undefined4 *)(iVar1 + 4);

  iVar1 = *param_2;

  *param_2 = iVar1 + 4;

  *(undefined4 *)(param_1 + 0x20) = *(undefined4 *)(iVar1 + 4);

  iVar1 = *param_2;

  *param_2 = iVar1 + 4;

  *(undefined4 *)(param_1 + 0x24) = *(undefined4 *)(iVar1 + 4);

  iVar1 = *param_2;

  *param_2 = iVar1 + 4;

  *(undefined4 *)(param_1 + 0x28) = *(undefined4 *)(iVar1 + 4);

  iVar1 = *param_2;

  *param_2 = iVar1 + 4;

  *(undefined4 *)(param_1 + 0x2c) = *(undefined4 *)(iVar1 + 4);

  iVar1 = *param_2;

  *param_2 = iVar1 + 4;

  *(undefined4 *)(param_1 + 0x14) = *(undefined4 *)(iVar1 + 4);

  *param_2 = *param_2 + 4;

  uVar2 = FUN_004fd460(param_2,param_3);

  return uVar2;

}





// --- FUN_005bacc0 at 0x005BACC0 (size: 18) ---


void FUN_005bacc0(int param_1)



{

  FUN_005c9610(param_1,param_1 + 1);

  return;

}





// --- FUN_005bace0 at 0x005BACE0 (size: 94) ---


/* WARNING: Globals starting with '_' overlap smaller symbols at the same address */



float10 FUN_005bace0(undefined4 param_1)



{

  switch(param_1) {

  case 1:

    return (float10)_DAT_007938b0;

  case 2:

    return (float10)_DAT_0079c6dc;

  case 3:

    return (float10)_DAT_007958c4;

  case 4:

    return (float10)_DAT_007e8398;

  case 5:

    return (float10)_DAT_007938b8;

  case 6:

    return (float10)_DAT_007c9f9c;

  case 7:

    return (float10)_DAT_007cb7a8;

  case 8:

    return (float10)_DAT_007e8394;

  case 9:

    return (float10)_DAT_007e8390;

  case 10:

    return (float10)_DAT_007e838c;

  default:

    return (float10)DAT_00796344;

  }

}





// --- FUN_005bad70 at 0x005BAD70 (size: 41) ---


undefined4 __thiscall FUN_005bad70(int param_1,int param_2)



{

  char cVar1;

  

  if (*(int *)(param_1 + 4) == *(int *)(param_2 + 4)) {

    cVar1 = FUN_004ab9d0(param_2 + 8);

    if (cVar1 != '\0') {

      return 1;

    }

  }

  return 0;

}





// --- FUN_005bae60 at 0x005BAE60 (size: 110) ---


undefined4 __thiscall FUN_005bae60(int param_1,int *param_2,uint param_3)



{

  int iVar1;

  

  if (param_3 < 0xc) {

    return 0;

  }

  *(undefined4 *)(param_1 + 4) = *(undefined4 *)*param_2;

  iVar1 = *param_2;

  *param_2 = iVar1 + 4;

  *(undefined4 *)(param_1 + 0xc) = *(undefined4 *)(iVar1 + 4);

  iVar1 = *param_2;

  *param_2 = iVar1 + 4;

  *(undefined4 *)(param_1 + 0x10) = *(undefined4 *)(iVar1 + 4);

  *param_2 = *param_2 + 4;

  FUN_004fd460(param_2,param_3);

  (**(code **)(*(int *)(param_1 + 0x24) + 0x10))(param_2,param_3);

  (**(code **)(*(int *)(param_1 + 0x38) + 0x10))(param_2,param_3);

  return 1;

}





// --- FUN_005baed0 at 0x005BAED0 (size: 97) ---


undefined4 * __fastcall FUN_005baed0(undefined4 *param_1)



{

  LONG *lpAddend;

  

  *param_1 = &PTR_FUN_007a5178;

  param_1[1] = 0;

  lpAddend = (LONG *)(DAT_008ef11c + 4);

  param_1[2] = DAT_008ef11c;

  InterlockedIncrement(lpAddend);

  param_1[3] = 0;

  param_1[4] = 0;

  param_1[6] = 0;

  param_1[7] = 0;

  param_1[8] = 0;

  param_1[9] = &PTR_FUN_0079385c;

  param_1[9] = &PTR_LAB_007a5164;

  param_1[5] = &PTR_FUN_007a83d8;

  param_1[0xb] = 0;

  param_1[0xc] = 0;

  param_1[0xd] = 0;

  param_1[0xe] = &PTR_FUN_0079385c;

  param_1[0xe] = &PTR_LAB_007a5164;

  param_1[10] = &PTR_FUN_007a83d8;

  return param_1;

}





// --- FUN_005baf40 at 0x005BAF40 (size: 115) ---


int __thiscall FUN_005baf40(int param_1,int param_2)



{

  undefined4 *puVar1;

  int iVar2;

  LONG LVar3;

  

  if (param_1 != param_2) {

    *(undefined4 *)(param_1 + 4) = *(undefined4 *)(param_2 + 4);

    puVar1 = *(undefined4 **)(param_1 + 8);

    if (puVar1 != *(undefined4 **)(param_2 + 8)) {

      LVar3 = InterlockedDecrement(puVar1 + 1);

      if ((LVar3 == 0) && (puVar1 != (undefined4 *)0x0)) {

        (**(code **)*puVar1)(1);

      }

      iVar2 = *(int *)(param_2 + 8);

      *(int *)(param_1 + 8) = iVar2;

      InterlockedIncrement((LONG *)(iVar2 + 4));

    }

    *(undefined4 *)(param_1 + 0xc) = *(undefined4 *)(param_2 + 0xc);

    *(undefined4 *)(param_1 + 0x10) = *(undefined4 *)(param_2 + 0x10);

    FUN_004db900(param_2 + 0x14);

    FUN_004db900(param_2 + 0x28);

  }

  return param_1;

}





// --- FUN_005bafc0 at 0x005BAFC0 (size: 111) ---


undefined4 * __thiscall FUN_005bafc0(undefined4 *param_1,undefined4 param_2)



{

  LONG *lpAddend;

  

  *param_1 = &PTR_FUN_007a5178;

  param_1[1] = 0;

  lpAddend = (LONG *)(DAT_008ef11c + 4);

  param_1[2] = DAT_008ef11c;

  InterlockedIncrement(lpAddend);

  param_1[3] = 0;

  param_1[4] = 0;

  param_1[6] = 0;

  param_1[7] = 0;

  param_1[8] = 0;

  param_1[9] = &PTR_FUN_0079385c;

  param_1[5] = &PTR_FUN_007a83d8;

  param_1[9] = &PTR_LAB_007a5164;

  param_1[0xb] = 0;

  param_1[0xc] = 0;

  param_1[0xd] = 0;

  param_1[0xe] = &PTR_FUN_0079385c;

  param_1[10] = &PTR_FUN_007a83d8;

  param_1[0xe] = &PTR_LAB_007a5164;

  FUN_005baf40(param_2);

  return param_1;

}





// --- FUN_005bb030 at 0x005BB030 (size: 45) ---


undefined4 __thiscall FUN_005bb030(int param_1,int param_2,undefined4 param_3,undefined4 param_4)



{

  if (param_2 != 0) {

    *(int *)(param_1 + 0x24) = param_2;

    *(undefined4 *)(param_1 + 0x28) = param_3;

    *(undefined4 *)(param_1 + 0x2c) = param_4;

    *(undefined4 *)(param_1 + 0x30) = 2;

    return 1;

  }

  return 0;

}





// --- FUN_005bb0a0 at 0x005BB0A0 (size: 52) ---


undefined4 __thiscall FUN_005bb0a0(int param_1,undefined4 param_2)



{

  int iVar1;

  int iVar2;

  

  iVar1 = *(int *)(param_1 + 4);

  while( true ) {

    if (iVar1 == 0) {

      return 0;

    }

    iVar2 = FUN_006b0d80(param_2);

    if (iVar2 != 0) break;

    iVar1 = *(int *)(iVar1 + 0xc);

  }

  return 1;

}





// --- FUN_005bb0e0 at 0x005BB0E0 (size: 73) ---


undefined4 __thiscall FUN_005bb0e0(int param_1,undefined4 param_2)



{

  int iVar1;

  int iVar2;

  undefined1 local_c [12];

  

  FUN_006b0da0(param_2);

  iVar1 = *(int *)(param_1 + 0x18);

  while( true ) {

    if (iVar1 == 0) {

      return 0;

    }

    iVar2 = FUN_006b0d80(local_c);

    if (iVar2 != 0) break;

    iVar1 = *(int *)(iVar1 + 0xc);

  }

  return 1;

}





// --- FUN_005bb1c0 at 0x005BB1C0 (size: 32) ---


int __fastcall FUN_005bb1c0(int param_1)



{

  int iVar1;

  int iVar2;

  

  iVar2 = 0;

  for (iVar1 = *(int *)(param_1 + 8); iVar1 != 0; iVar1 = *(int *)(iVar1 + 0xc)) {

    if (*(int *)(iVar1 + 8) == 0) {

      iVar2 = iVar2 + 1;

    }

  }

  return iVar2;

}





// --- FUN_005bb1e0 at 0x005BB1E0 (size: 32) ---


int __fastcall FUN_005bb1e0(int param_1)



{

  int iVar1;

  int iVar2;

  

  iVar2 = 0;

  for (iVar1 = *(int *)(param_1 + 8); iVar1 != 0; iVar1 = *(int *)(iVar1 + 0xc)) {

    if (*(int *)(iVar1 + 8) != 0) {

      iVar2 = iVar2 + 1;

    }

  }

  return iVar2;

}





// --- FUN_005bb200 at 0x005BB200 (size: 32) ---


int __fastcall FUN_005bb200(int param_1)



{

  int iVar1;

  int iVar2;

  

  iVar2 = 0;

  for (iVar1 = *(int *)(param_1 + 0x18); iVar1 != 0; iVar1 = *(int *)(iVar1 + 0xc)) {

    if (*(int *)(iVar1 + 8) == 0) {

      iVar2 = iVar2 + 1;

    }

  }

  return iVar2;

}





// --- FUN_005bb220 at 0x005BB220 (size: 32) ---


int __fastcall FUN_005bb220(int param_1)



{

  int iVar1;

  int iVar2;

  

  iVar2 = 0;

  for (iVar1 = *(int *)(param_1 + 0x18); iVar1 != 0; iVar1 = *(int *)(iVar1 + 0xc)) {

    if (*(int *)(iVar1 + 8) != 0) {

      iVar2 = iVar2 + 1;

    }

  }

  return iVar2;

}





// --- FUN_005bb240 at 0x005BB240 (size: 175) ---


int __thiscall FUN_005bb240(int param_1,int param_2,int param_3)



{

  int iVar1;

  int iVar2;

  undefined4 *puVar3;

  

  puVar3 = (undefined4 *)FUN_005df0f5(0x14);

  if (puVar3 == (undefined4 *)0x0) {

    puVar3 = (undefined4 *)0x0;

  }

  else {

    *puVar3 = &PTR_FUN_007cd42c;

    puVar3[1] = *(undefined4 *)(param_3 + 4);

    puVar3[2] = *(undefined4 *)(param_3 + 8);

    puVar3[3] = 0;

    puVar3[4] = 0;

  }

  iVar1 = *(int *)(param_1 + 4);

  iVar2 = param_2;

  if (iVar1 == 0) {

    *(undefined4 **)(param_1 + 4) = puVar3;

    *(undefined4 **)(param_1 + 8) = puVar3;

    *(int *)(param_1 + 0xc) = *(int *)(param_1 + 0xc) + 1;

    return 0;

  }

  for (; iVar2 != 0; iVar2 = iVar2 + -1) {

    if (iVar1 == 0) goto LAB_005bb2ae;

    iVar1 = *(int *)(iVar1 + 0xc);

  }

  if (iVar1 != 0) {

    if (*(int *)(iVar1 + 0x10) == 0) {

      *(undefined4 **)(param_1 + 4) = puVar3;

    }

    else {

      *(undefined4 **)(*(int *)(iVar1 + 0x10) + 0xc) = puVar3;

    }

    puVar3[4] = *(undefined4 *)(iVar1 + 0x10);

    puVar3[3] = iVar1;

    *(undefined4 **)(iVar1 + 0x10) = puVar3;

    *(int *)(param_1 + 0xc) = *(int *)(param_1 + 0xc) + 1;

    return param_2;

  }

LAB_005bb2ae:

  iVar1 = *(int *)(param_1 + 8);

  *(undefined4 **)(iVar1 + 0xc) = puVar3;

  puVar3[4] = iVar1;

  *(undefined4 **)(param_1 + 8) = puVar3;

  iVar1 = *(int *)(param_1 + 0xc);

  *(int *)(param_1 + 0xc) = iVar1 + 1;

  return iVar1;

}





// --- FUN_005bb2f0 at 0x005BB2F0 (size: 102) ---


undefined4 FUN_005bb2f0(int param_1,int param_2,undefined4 param_3)



{

  int iVar1;

  undefined1 local_c [12];

  

  if (param_1 != 0) {

    FUN_006b0da0(param_1);

    iVar1 = FUN_005bb0a0(local_c);

    if ((iVar1 == 0) && (*(uint *)(param_2 + 0xc) < 0x1a0a)) {

      FUN_006b0da0(param_1);

      FUN_005bb240(param_3,local_c);

      return 1;

    }

  }

  return 0;

}





// --- FUN_005bb360 at 0x005BB360 (size: 228) ---


undefined4 __thiscall FUN_005bb360(int param_1,int param_2)



{

  undefined4 *puVar1;

  undefined4 *puVar2;

  int iVar3;

  

  puVar1 = *(undefined4 **)(param_1 + 4);

  if (puVar1 == (undefined4 *)0x0) {

    return 0;

  }

  iVar3 = FUN_006b0d80(param_2);

  if (iVar3 != 0) {

    iVar3 = *(int *)(param_1 + 4);

    *(undefined4 *)(param_2 + 4) = *(undefined4 *)(iVar3 + 4);

    *(undefined4 *)(param_2 + 8) = *(undefined4 *)(iVar3 + 8);

    iVar3 = *(int *)(*(int *)(param_1 + 4) + 0xc);

    *(int *)(param_1 + 4) = iVar3;

    if (iVar3 == 0) {

      *(undefined4 *)(param_1 + 8) = 0;

    }

    else {

      *(undefined4 *)(iVar3 + 0x10) = 0;

    }

    if (puVar1 != (undefined4 *)0x0) {

      *puVar1 = &PTR_FUN_0079385c;

      operator_delete(puVar1);

    }

    *(int *)(param_1 + 0xc) = *(int *)(param_1 + 0xc) + -1;

    return 1;

  }

  iVar3 = puVar1[3];

  while( true ) {

    if (iVar3 == 0) {

      return 0;

    }

    iVar3 = FUN_006b0d80(param_2);

    if (iVar3 != 0) break;

    puVar1 = (undefined4 *)puVar1[3];

    iVar3 = puVar1[3];

  }

  iVar3 = puVar1[3];

  *(undefined4 *)(param_2 + 4) = *(undefined4 *)(iVar3 + 4);

  *(undefined4 *)(param_2 + 8) = *(undefined4 *)(iVar3 + 8);

  puVar2 = (undefined4 *)puVar1[3];

  iVar3 = puVar2[3];

  puVar1[3] = iVar3;

  if (iVar3 == 0) {

    *(undefined4 **)(param_1 + 8) = puVar1;

  }

  else {

    *(undefined4 **)(iVar3 + 0x10) = puVar1;

  }

  *puVar2 = &PTR_FUN_0079385c;

  operator_delete(puVar2);

  *(int *)(param_1 + 0xc) = *(int *)(param_1 + 0xc) + -1;

  return 1;

}





// --- FUN_005bb450 at 0x005BB450 (size: 135) ---


undefined4 __thiscall FUN_005bb450(int param_1,undefined4 param_2,int param_3,undefined4 param_4)



{

  int iVar1;

  undefined4 uVar2;

  undefined **local_18 [3];

  undefined **local_c [3];

  

  if (param_3 == 1) {

    FUN_006b0da0(param_2);

    iVar1 = FUN_005bb0a0(local_c);

    local_c[0] = &PTR_FUN_0079385c;

    if (iVar1 == 0) {

      param_1 = param_1 + 4;

LAB_005bb4c1:

      uVar2 = FUN_005bb2f0(param_2,param_1,param_4);

      return uVar2;

    }

  }

  else if (param_3 == 2) {

    FUN_006b0da0(param_2);

    iVar1 = FUN_005bb0a0(local_18);

    local_18[0] = &PTR_FUN_0079385c;

    if (iVar1 == 0) {

      param_1 = param_1 + 0x14;

      goto LAB_005bb4c1;

    }

  }

  return 0;

}





// --- FUN_005bb4e0 at 0x005BB4E0 (size: 141) ---


undefined4 FUN_005bb4e0(int param_1,int param_2)



{

  undefined4 uVar1;

  undefined **local_24;

  undefined4 local_20;

  undefined4 local_1c;

  undefined4 local_14;

  undefined4 local_10;

  undefined4 local_8;

  undefined4 local_4;

  

  if (param_1 != 0) {

    if (param_2 == 1) {

      FUN_006b0da0(param_1);

      local_1c = local_4;

      local_24 = &PTR_FUN_007cd42c;

      local_20 = local_8;

      uVar1 = FUN_005bb360(&local_24);

      return uVar1;

    }

    if (param_2 == 2) {

      FUN_006b0da0(param_1);

      local_1c = local_10;

      local_24 = &PTR_FUN_007cd42c;

      local_20 = local_14;

      uVar1 = FUN_005bb360(&local_24);

      return uVar1;

    }

  }

  return 0;

}





// --- FUN_005bb570 at 0x005BB570 (size: 34) ---


undefined4 __fastcall FUN_005bb570(int param_1)



{

  FUN_0055b780();

  FUN_0055b780();

  *(undefined4 *)(param_1 + 0x38) = 0;

  *(undefined4 *)(param_1 + 0x3c) = 0;

  return 1;

}





// --- FUN_005bb6a0 at 0x005BB6A0 (size: 75) ---


void __fastcall FUN_005bb6a0(undefined4 *param_1)



{

  undefined4 uVar1;

  

  *param_1 = &PTR_FUN_007e83a8;

  param_1[2] = 0;

  param_1[3] = 0;

  param_1[4] = 0;

  param_1[1] = &PTR_FUN_007cd418;

  param_1[5] = &PTR_FUN_007cd418;

  uVar1 = DAT_007e83a0;

  param_1[6] = 0;

  param_1[7] = 0;

  param_1[8] = 0;

  param_1[0xb] = DAT_007e83a4;

  param_1[9] = 0;

  param_1[10] = uVar1;

  param_1[0xc] = 0;

  param_1[0xd] = 0;

  param_1[0xe] = 0;

  param_1[0xf] = 0;

  return;

}





// --- FUN_005bb6f0 at 0x005BB6F0 (size: 47) ---


undefined4 * __thiscall FUN_005bb6f0(undefined4 *param_1,byte param_2)



{

  FUN_0055bc00();

  FUN_0055bc00();

  *param_1 = &PTR_FUN_0079385c;

  if ((param_2 & 1) != 0) {

    operator_delete(param_1);

  }

  return param_1;

}





// --- FUN_005bb720 at 0x005BB720 (size: 148) ---


int __thiscall FUN_005bb720(int param_1,int param_2,int param_3)



{

  int iVar1;

  int iVar2;

  

  iVar1 = *(int *)(param_1 + 4);

  if ((DAT_0084042c & 1) == 0) {

    DAT_0084042c = DAT_0084042c | 1;

    FUN_00415640(&DAT_00840428,0x10000002,0xc);

    _atexit((_func_4879 *)&DAT_00762240);

  }

  if (((iVar1 == DAT_00840428) && (0 < param_2)) && (0 < param_3)) {

    iVar1 = *(int *)(param_1 + 0xc);

    if (((iVar1 < *(int *)(param_1 + 8)) && (iVar2 = *(int *)(param_1 + 8) - iVar1, 0 < iVar2)) &&

       ((param_3 <= iVar2 && (iVar2 = iVar2 / param_3, 0 < iVar2)))) {

      if (param_2 < iVar2) {

        iVar2 = param_2;

      }

      *(int *)(param_1 + 0xc) = iVar2 * param_3 + iVar1;

      return iVar2;

    }

  }

  return 0;

}





// --- FUN_005bb7c0 at 0x005BB7C0 (size: 32) ---


undefined4 __fastcall FUN_005bb7c0(int param_1)



{

  int iVar1;

  

  for (iVar1 = *(int *)(param_1 + 4); iVar1 != 0; iVar1 = *(int *)(iVar1 + 0x18)) {

    *(undefined4 *)(iVar1 + 0xc) = 0;

  }

  return 1;

}





// --- FUN_005bb7e0 at 0x005BB7E0 (size: 31) ---


undefined4 __fastcall FUN_005bb7e0(int param_1)



{

  int iVar1;

  

  iVar1 = *(int *)(param_1 + 4);

  while( true ) {

    if (iVar1 == 0) {

      return 1;

    }

    if (*(int *)(iVar1 + 0xc) < *(int *)(iVar1 + 8)) break;

    iVar1 = *(int *)(iVar1 + 0x18);

  }

  return 0;

}





// --- FUN_005bb800 at 0x005BB800 (size: 193) ---


undefined4 __thiscall FUN_005bb800(int param_1,int param_2)



{

  int iVar1;

  int iVar2;

  int iVar3;

  char cVar4;

  

  iVar3 = param_2;

  iVar1 = *(int *)(param_1 + 4);

  while( true ) {

    if (iVar1 == 0) {

      return 0;

    }

    iVar2 = *(int *)(iVar1 + 4);

    if ((DAT_0084042c & 1) == 0) {

      DAT_0084042c = DAT_0084042c | 1;

      FUN_00415640(&DAT_00840428,0x10000002,0xc);

      _atexit((_func_4879 *)&DAT_00762240);

    }

    if ((iVar2 == DAT_00840428) && (cVar4 = FUN_005bc3a0(iVar3 + 4,&param_2), cVar4 != '\0')) break;

    if (*(int *)(iVar3 + 4) == *(int *)(iVar1 + 4)) {

      param_2 = *(int *)(iVar3 + 8);

      goto LAB_005bb894;

    }

    iVar1 = *(int *)(iVar1 + 0x18);

  }

  if (*(int *)(iVar3 + 8) < 1) {

    return 0;

  }

  if (param_2 < 1) {

    return 0;

  }

  param_2 = *(int *)(iVar3 + 8) * param_2;

LAB_005bb894:

  if (param_2 < 1) {

    return 0;

  }

  if (param_2 <= *(int *)(iVar1 + 0xc)) {

    *(int *)(iVar1 + 0xc) = *(int *)(iVar1 + 0xc) - param_2;

    return 1;

  }

  *(undefined4 *)(iVar1 + 0xc) = 0;

  return 1;

}





// --- FUN_005bb8d0 at 0x005BB8D0 (size: 181) ---


bool __thiscall FUN_005bb8d0(uint param_1,int param_2)



{

  int iVar1;

  int iVar2;

  char cVar3;

  uint local_4;

  

  iVar1 = *(int *)(param_1 + 4);

  local_4 = param_1;

  while( true ) {

    if (iVar1 == 0) {

      return false;

    }

    iVar2 = *(int *)(iVar1 + 4);

    if ((DAT_0084042c & 1) == 0) {

      DAT_0084042c = DAT_0084042c | 1;

      FUN_00415640(&DAT_00840428,0x10000002,0xc);

      _atexit((_func_4879 *)&DAT_00762240);

    }

    if (iVar2 == DAT_00840428) {

      local_4 = 0;

      cVar3 = FUN_005bc3a0(&param_2,&local_4);

      if (cVar3 != '\0') {

        if (*(int *)(iVar1 + 8) <= *(int *)(iVar1 + 0xc)) {

          return false;

        }

        return local_4 <= (uint)(*(int *)(iVar1 + 8) - *(int *)(iVar1 + 0xc));

      }

    }

    if (*(int *)(iVar1 + 4) == param_2) break;

    iVar1 = *(int *)(iVar1 + 0x18);

  }

  return *(int *)(iVar1 + 0xc) < *(int *)(iVar1 + 8);

}





// --- FUN_005bb990 at 0x005BB990 (size: 201) ---


int __thiscall FUN_005bb990(int param_1,int param_2,int param_3)



{

  int iVar1;

  int iVar2;

  char cVar3;

  int iVar4;

  int local_4;

  

  iVar4 = *(int *)(param_1 + 4);

  local_4 = param_1;

  while( true ) {

    if (iVar4 == 0) {

      return 0;

    }

    iVar1 = *(int *)(iVar4 + 4);

    if ((DAT_0084042c & 1) == 0) {

      DAT_0084042c = DAT_0084042c | 1;

      FUN_00415640(&DAT_00840428,0x10000002,0xc);

      _atexit((_func_4879 *)&DAT_00762240);

    }

    if ((iVar1 == DAT_00840428) && (cVar3 = FUN_005bc3a0(&param_2,&local_4), cVar3 != '\0')) {

      iVar4 = FUN_005bb720(param_3,local_4);

      return iVar4;

    }

    if (param_2 == *(int *)(iVar4 + 4)) break;

    iVar4 = *(int *)(iVar4 + 0x18);

  }

  if (param_3 < 1) {

    return 0;

  }

  iVar1 = *(int *)(iVar4 + 0xc);

  iVar2 = *(int *)(iVar4 + 8);

  if (iVar2 <= iVar1) {

    return 0;

  }

  if (iVar1 + param_3 <= iVar2) {

    *(int *)(iVar4 + 0xc) = iVar1 + param_3;

    return param_3;

  }

  *(int *)(iVar4 + 0xc) = iVar2;

  return iVar2 - iVar1;

}





// --- FUN_005bba60 at 0x005BBA60 (size: 139) ---


int __thiscall FUN_005bba60(int param_1,int param_2)



{

  undefined4 *puVar1;

  int iVar2;

  LONG LVar3;

  

  if (param_1 != param_2) {

    *(undefined4 *)(param_1 + 8) = *(undefined4 *)(param_2 + 8);

    *(undefined4 *)(param_1 + 0xc) = *(undefined4 *)(param_2 + 0xc);

    *(undefined4 *)(param_1 + 4) = *(undefined4 *)(param_2 + 4);

    puVar1 = *(undefined4 **)(param_1 + 0x10);

    if (puVar1 != *(undefined4 **)(param_2 + 0x10)) {

      LVar3 = InterlockedDecrement(puVar1 + 1);

      if ((LVar3 == 0) && (puVar1 != (undefined4 *)0x0)) {

        (**(code **)*puVar1)(1);

      }

      iVar2 = *(int *)(param_2 + 0x10);

      *(int *)(param_1 + 0x10) = iVar2;

      InterlockedIncrement((LONG *)(iVar2 + 4));

    }

    puVar1 = *(undefined4 **)(param_1 + 0x14);

    if (puVar1 != *(undefined4 **)(param_2 + 0x14)) {

      LVar3 = InterlockedDecrement(puVar1 + 1);

      if ((LVar3 == 0) && (puVar1 != (undefined4 *)0x0)) {

        (**(code **)*puVar1)(1);

      }

      iVar2 = *(int *)(param_2 + 0x14);

      *(int *)(param_1 + 0x14) = iVar2;

      InterlockedIncrement((LONG *)(iVar2 + 4));

    }

  }

  return param_1;

}





// --- FUN_005bbb90 at 0x005BBB90 (size: 26) ---


bool FUN_005bbb90(int param_1)



{

  int iVar1;

  

  iVar1 = FUN_005bb990(*(undefined4 *)(param_1 + 4),*(undefined4 *)(param_1 + 8));

  return iVar1 != 0;

}





// --- FUN_005bbbb0 at 0x005BBBB0 (size: 68) ---


undefined4 * __thiscall FUN_005bbbb0(undefined4 *param_1,undefined4 param_2)



{

  LONG *pLVar1;

  

  *param_1 = &PTR_LAB_007ac6e0;

  pLVar1 = (LONG *)(DAT_008ef11c + 4);

  param_1[4] = DAT_008ef11c;

  InterlockedIncrement(pLVar1);

  pLVar1 = (LONG *)(DAT_008ef11c + 4);

  param_1[5] = DAT_008ef11c;

  InterlockedIncrement(pLVar1);

  FUN_005bba60(param_2);

  return param_1;

}





// --- FUN_005bbc00 at 0x005BBC00 (size: 138) ---


bool __thiscall FUN_005bbc00(int param_1,int *param_2,uint param_3)



{

  undefined4 *puVar1;

  undefined4 uVar2;

  undefined4 *puVar3;

  int iVar4;

  

  if (param_3 < 0xc) {

    return false;

  }

  puVar1 = (undefined4 *)*param_2;

  *(undefined4 *)(param_1 + 8) = *puVar1;

  iVar4 = *param_2;

  *param_2 = iVar4 + 4;

  *(undefined4 *)(param_1 + 0xc) = *(undefined4 *)(iVar4 + 4);

  iVar4 = *param_2;

  puVar3 = (undefined4 *)(iVar4 + 4);

  *param_2 = (int)puVar3;

  uVar2 = *puVar3;

  *param_2 = iVar4 + 8;

  *(undefined4 *)(param_1 + 4) = uVar2;

  if ((uint)(*param_2 - (int)puVar1) < param_3) {

    iVar4 = param_3 - (*param_2 - (int)puVar1);

  }

  else {

    iVar4 = 0;

  }

  iVar4 = FUN_004fd460(param_2,iVar4);

  if (iVar4 == 0) {

    return false;

  }

  if ((uint)(*param_2 - (int)puVar1) < param_3) {

    iVar4 = param_3 - (*param_2 - (int)puVar1);

  }

  else {

    iVar4 = 0;

  }

  iVar4 = FUN_004fd460(param_2,iVar4);

  return iVar4 != 0;

}





// --- FUN_005bbc90 at 0x005BBC90 (size: 311) ---


undefined4 __thiscall FUN_005bbc90(int param_1,undefined4 *param_2)



{

  undefined4 *puVar1;

  int iVar2;

  uint uVar3;

  char *pcVar4;

  LONG LVar5;

  

  if (*(int *)(param_1 + 8) == 1) {

    puVar1 = *(undefined4 **)(param_1 + 0x10);

    if ((puVar1[2] != 1) && (puVar1 != DAT_008ef11c)) {

      FUN_004910c0(puVar1 + 5,puVar1[2] + -1);

      return 1;

    }

  }

  else {

    puVar1 = *(undefined4 **)(param_1 + 0x14);

    if (puVar1[2] == 1) {

      puVar1 = *(undefined4 **)(param_1 + 0x10);

      if ((puVar1[2] != 1) && (puVar1 != DAT_008ef11c)) {

        FUN_004910c0(puVar1 + 5,puVar1[2] + -1);

      }

      iVar2 = *(int *)(param_1 + 0x10);

      uVar3 = *(uint *)(iVar2 + 8);

      pcVar4 = (char *)(uVar3 + 0x13 + iVar2);

      if (uVar3 - 1 < uVar3) {

        pcVar4 = (char *)(iVar2 + 0x14 + (uVar3 - 1));

      }

      if ((*pcVar4 != 's') && (*pcVar4 != 'x')) {

        FUN_0048c3e0(&DAT_00795520);

        FUN_004914f0(&param_2);

        FUN_005abb30();

        return 1;

      }

      FUN_0048c3e0(&DAT_007e50b8);

      puVar1 = param_2;

      if ((param_2[2] != 1) && (param_2 != DAT_008ef11c)) {

        FUN_004910c0(param_2 + 5,param_2[2] + -1);

      }

      LVar5 = InterlockedDecrement(puVar1 + 1);

      if (LVar5 == 0) {

        (**(code **)*puVar1)(1);

      }

    }

    else if ((puVar1[2] != 1) && (puVar1 != DAT_008ef11c)) {

      FUN_004910c0(puVar1 + 5,puVar1[2] + -1);

      return 1;

    }

  }

  return 1;

}





// --- FUN_005bbdd0 at 0x005BBDD0 (size: 73) ---


uint __thiscall FUN_005bbdd0(int param_1,int *param_2,uint param_3)



{

  int *piVar1;

  uint uVar2;

  

  uVar2 = FUN_005ca8a0();

  if (uVar2 <= param_3) {

    if (3 < param_3) {

      *(undefined4 *)*param_2 = *(undefined4 *)(param_1 + 0xc);

      *param_2 = *param_2 + 4;

    }

    for (piVar1 = *(int **)(param_1 + 4); piVar1 != (int *)0x0; piVar1 = (int *)piVar1[6]) {

      (**(code **)(*piVar1 + 0xc))(param_2,param_3);

    }

  }

  return uVar2;

}





// --- FUN_005bbe20 at 0x005BBE20 (size: 427) ---


undefined4 __thiscall FUN_005bbe20(int param_1,int *param_2,uint param_3)



{

  int iVar1;

  int iVar2;

  undefined4 *puVar3;

  LONG LVar4;

  LONG *pLVar5;

  int local_20;

  undefined **local_18;

  undefined4 local_14;

  undefined4 local_10;

  undefined4 local_c;

  undefined4 *local_8;

  undefined4 *local_4;

  

  FUN_004a2d40();

  if (param_3 < 4) {

    return 0;

  }

  iVar1 = *(int *)*param_2;

  *param_2 = (int)((int *)*param_2 + 1);

  local_14 = DAT_008f0498;

  local_8 = DAT_008ef11c;

  local_18 = &PTR_LAB_007ac6e0;

  local_10 = 0;

  local_c = 0;

  InterlockedIncrement(DAT_008ef11c + 1);

  local_4 = DAT_008ef11c;

  InterlockedIncrement(DAT_008ef11c + 1);

  local_20 = 0;

  if (0 < iVar1) {

    do {

      iVar2 = (*(code *)local_18[4])(param_2,param_3);

      puVar3 = local_4;

      if (iVar2 == 0) {

        LVar4 = InterlockedDecrement(local_4 + 1);

        if ((LVar4 == 0) && (puVar3 != (undefined4 *)0x0)) {

          (**(code **)*puVar3)(1);

        }

        puVar3 = local_8;

        LVar4 = InterlockedDecrement(local_8 + 1);

        if ((LVar4 == 0) && (puVar3 != (undefined4 *)0x0)) {

          (**(code **)*puVar3)(1);

        }

        return 0;

      }

      puVar3 = (undefined4 *)FUN_005df0f5(0x20);

      if (puVar3 == (undefined4 *)0x0) {

        puVar3 = (undefined4 *)0x0;

      }

      else {

        *puVar3 = &PTR_LAB_007ac6e0;

        pLVar5 = DAT_008ef11c + 1;

        puVar3[4] = DAT_008ef11c;

        InterlockedIncrement(pLVar5);

        pLVar5 = DAT_008ef11c + 1;

        puVar3[5] = DAT_008ef11c;

        InterlockedIncrement(pLVar5);

        FUN_005bba60(&local_18);

        puVar3[6] = 0;

        puVar3[7] = 0;

      }

      if (*(int *)(param_1 + 4) == 0) {

        *(undefined4 **)(param_1 + 4) = puVar3;

      }

      else {

        iVar2 = *(int *)(param_1 + 8);

        *(undefined4 **)(iVar2 + 0x18) = puVar3;

        puVar3[7] = iVar2;

      }

      *(undefined4 **)(param_1 + 8) = puVar3;

      local_20 = local_20 + 1;

      *(int *)(param_1 + 0xc) = *(int *)(param_1 + 0xc) + 1;

    } while (local_20 < iVar1);

  }

  puVar3 = local_4;

  LVar4 = InterlockedDecrement(local_4 + 1);

  if ((LVar4 == 0) && (puVar3 != (undefined4 *)0x0)) {

    (**(code **)*puVar3)(1);

  }

  puVar3 = local_8;

  LVar4 = InterlockedDecrement(local_8 + 1);

  if ((LVar4 == 0) && (puVar3 != (undefined4 *)0x0)) {

    (**(code **)*puVar3)(1);

  }

  return 1;

}





// --- FUN_005bbfe0 at 0x005BBFE0 (size: 22) ---


void __fastcall FUN_005bbfe0(undefined4 *param_1)



{

  *param_1 = &PTR_FUN_007e83bc;

  FUN_004a2d40();

  *param_1 = &PTR_FUN_0079385c;

  return;

}





// --- FUN_005bc000 at 0x005BC000 (size: 181) ---


void __thiscall FUN_005bc000(int param_1,undefined4 *param_2)



{

  undefined4 uVar1;

  undefined4 *puVar2;

  LONG LVar3;

  

  puVar2 = DAT_008ef11c;

  uVar1 = *(undefined4 *)(param_1 + 8);

  InterlockedIncrement(DAT_008ef11c + 1);

  FUN_004ad9c0(uVar1);

  if ((puVar2[2] != 1) && (puVar2 != DAT_008ef11c)) {

    FUN_004910c0(puVar2 + 5,puVar2[2] + -1);

  }

  LVar3 = InterlockedDecrement(puVar2 + 1);

  if (LVar3 == 0) {

    (**(code **)*puVar2)(1);

  }

  FUN_0048c3e0(&DAT_00795098);

  if ((param_2[2] != 1) && (param_2 != DAT_008ef11c)) {

    FUN_004910c0(param_2 + 5,param_2[2] + -1);

  }

  LVar3 = InterlockedDecrement(param_2 + 1);

  if (LVar3 == 0) {

    (**(code **)*param_2)(1);

  }

  FUN_005bbc90(param_2);

  return;

}





// --- FUN_005bc0c0 at 0x005BC0C0 (size: 335) ---


void __thiscall FUN_005bc0c0(int param_1,undefined4 *param_2)



{

  undefined4 uVar1;

  undefined4 *puVar2;

  LONG LVar3;

  

  puVar2 = DAT_008ef11c;

  uVar1 = *(undefined4 *)(param_1 + 0xc);

  InterlockedIncrement(DAT_008ef11c + 1);

  FUN_004ad9c0(uVar1);

  if ((puVar2[2] != 1) && (puVar2 != DAT_008ef11c)) {

    FUN_004910c0(puVar2 + 5,puVar2[2] + -1);

  }

  LVar3 = InterlockedDecrement(puVar2 + 1);

  if (LVar3 == 0) {

    (**(code **)*puVar2)(1);

  }

  FUN_0048c3e0(&DAT_007954ac);

  if ((param_2[2] != 1) && (param_2 != DAT_008ef11c)) {

    FUN_004910c0(param_2 + 5,param_2[2] + -1);

  }

  LVar3 = InterlockedDecrement(param_2 + 1);

  if (LVar3 == 0) {

    (**(code **)*param_2)(1);

  }

  puVar2 = DAT_008ef11c;

  uVar1 = *(undefined4 *)(param_1 + 8);

  InterlockedIncrement(DAT_008ef11c + 1);

  FUN_004ad9c0(uVar1);

  if ((puVar2[2] != 1) && (puVar2 != DAT_008ef11c)) {

    FUN_004910c0(puVar2 + 5,puVar2[2] + -1);

  }

  LVar3 = InterlockedDecrement(puVar2 + 1);

  if (LVar3 == 0) {

    (**(code **)*puVar2)(1);

  }

  FUN_0048c3e0(&DAT_00795098);

  if ((puVar2[2] != 1) && (puVar2 != DAT_008ef11c)) {

    FUN_004910c0(puVar2 + 5,puVar2[2] + -1);

  }

  LVar3 = InterlockedDecrement(puVar2 + 1);

  if (LVar3 == 0) {

    (**(code **)*puVar2)(1);

  }

  FUN_005bbc90(param_2);

  return;

}





// --- FUN_005bc210 at 0x005BC210 (size: 138) ---


undefined4 __thiscall FUN_005bc210(int param_1,undefined4 *param_2)



{

  int iVar1;

  LONG LVar2;

  int extraout_ECX;

  int extraout_ECX_00;

  

  for (iVar1 = *(int *)(param_1 + 4); iVar1 != 0; iVar1 = *(int *)(iVar1 + 0x18)) {

    FUN_005bc000(param_2);

    FUN_0048c3e0(&DAT_00795334);

    if ((param_2[2] != 1) && (param_2 != DAT_008ef11c)) {

      FUN_004910c0(param_2 + 5,param_2[2] + -1);

    }

    LVar2 = InterlockedDecrement(param_2 + 1);

    param_1 = extraout_ECX;

    if (LVar2 == 0) {

      (**(code **)*param_2)(1);

      param_1 = extraout_ECX_00;

    }

    if (iVar1 == 0) break;

  }

  FUN_0048c3e0(&DAT_00795334);

  FUN_0056f9a0(0,1,param_1);

  return 0;

}





// --- FUN_005bc2a0 at 0x005BC2A0 (size: 138) ---


undefined4 __thiscall FUN_005bc2a0(int param_1,undefined4 *param_2)



{

  int iVar1;

  LONG LVar2;

  int extraout_ECX;

  int extraout_ECX_00;

  

  for (iVar1 = *(int *)(param_1 + 4); iVar1 != 0; iVar1 = *(int *)(iVar1 + 0x18)) {

    FUN_005bc0c0(param_2);

    FUN_0048c3e0(&DAT_00795334);

    if ((param_2[2] != 1) && (param_2 != DAT_008ef11c)) {

      FUN_004910c0(param_2 + 5,param_2[2] + -1);

    }

    LVar2 = InterlockedDecrement(param_2 + 1);

    param_1 = extraout_ECX;

    if (LVar2 == 0) {

      (**(code **)*param_2)(1);

      param_1 = extraout_ECX_00;

    }

    if (iVar1 == 0) break;

  }

  FUN_0048c3e0(&DAT_00795334);

  FUN_0056f9a0(0,1,param_1);

  return 0;

}





// --- FUN_005bc330 at 0x005BC330 (size: 42) ---


undefined4 * __thiscall FUN_005bc330(undefined4 *param_1,byte param_2)



{

  *param_1 = &PTR_FUN_007e83bc;

  FUN_004a2d40();

  *param_1 = &PTR_FUN_0079385c;

  if ((param_2 & 1) != 0) {

    operator_delete(param_1);

  }

  return param_1;

}





// --- FUN_005bc360 at 0x005BC360 (size: 22) ---


bool FUN_005bc360(int param_1)



{

  int iVar1;

  

  iVar1 = FUN_0040fa90();

  return 0x278d00 < iVar1 - param_1;

}





// --- FUN_005bc380 at 0x005BC380 (size: 23) ---


/* WARNING: Globals starting with '_' overlap smaller symbols at the same address */



float10 FUN_005bc380(int *param_1)



{

  if (*param_1 == 4) {

    return (float10)_DAT_007e83d8;

  }

  return (float10)_DAT_007e83d0;

}





// --- FUN_005bc3a0 at 0x005BC3A0 (size: 68) ---


undefined1 FUN_005bc3a0(undefined4 *param_1,undefined4 *param_2)



{

  undefined1 uVar1;

  int *piVar2;

  

  uVar1 = 0;

  *param_2 = 0;

  piVar2 = (int *)FUN_00415730(10,0x10000001,0x28);

  if (piVar2 != (int *)0x0) {

    uVar1 = FUN_00415ce0(*param_1,param_2);

    (**(code **)(*piVar2 + 0x14))();

  }

  return uVar1;

}





// --- FUN_005bc3f0 at 0x005BC3F0 (size: 165) ---


undefined4 FUN_005bc3f0(int param_1)



{

  tm *_Tm;

  LONG LVar1;

  char *pcVar2;

  undefined4 *local_204;

  char local_200 [512];

  

  if (param_1 == 0) {

    pcVar2 = "N/A";

  }

  else {

    _Tm = localtime((time_t *)&param_1);

    if (_Tm == (tm *)0x0) {

      return 0;

    }

    strftime(local_200,0x200,"%c",_Tm);

    pcVar2 = local_200;

  }

  FUN_0048c3e0(pcVar2);

  if ((local_204[2] != 1) && (local_204 != DAT_008ef11c)) {

    FUN_004910c0(local_204 + 5,local_204[2] + -1);

  }

  LVar1 = InterlockedDecrement(local_204 + 1);

  if (LVar1 == 0) {

    (**(code **)*local_204)(1);

  }

  return 1;

}





// --- FUN_005bc4a0 at 0x005BC4A0 (size: 335) ---


undefined4 FUN_005bc4a0(void)



{

  undefined4 *puVar1;

  undefined4 *puVar2;

  undefined4 uVar3;

  LONG LVar4;

  

  uVar3 = FUN_005df4c4();

  puVar1 = DAT_008ef11c;

  InterlockedIncrement(DAT_008ef11c + 1);

  FUN_004ad9c0(uVar3);

  FUN_004034c0("Warning!  You have not paid your maintenance costs for the last ");

  puVar2 = DAT_008ef11c;

  InterlockedIncrement(DAT_008ef11c + 1);

  FUN_004ad9c0(uVar3);

  if ((puVar2[2] != 1) && (puVar2 != DAT_008ef11c)) {

    FUN_004910c0(puVar2 + 5,puVar2[2] + -1);

  }

  LVar4 = InterlockedDecrement(puVar2 + 1);

  if (LVar4 == 0) {

    (**(code **)*puVar2)(1);

  }

  FUN_0048c3e0(" day maintenance period.  Please pay these costs by this deadline");

  if ((puVar2[2] != 1) && (puVar2 != DAT_008ef11c)) {

    FUN_004910c0(puVar2 + 5,puVar2[2] + -1);

  }

  LVar4 = InterlockedDecrement(puVar2 + 1);

  if (LVar4 == 0) {

    (**(code **)*puVar2)(1);

  }

  FUN_0048c3e0(" or you will lose your house, and all your items within it.");

  if ((puVar2[2] != 1) && (puVar2 != DAT_008ef11c)) {

    FUN_004910c0(puVar2 + 5,puVar2[2] + -1);

  }

  LVar4 = InterlockedDecrement(puVar2 + 1);

  if (LVar4 == 0) {

    (**(code **)*puVar2)(1);

  }

  LVar4 = InterlockedDecrement(puVar1 + 1);

  if ((LVar4 == 0) && (puVar1 != (undefined4 *)0x0)) {

    (**(code **)*puVar1)(1);

  }

  return 1;

}





// --- FUN_005bc6c0 at 0x005BC6C0 (size: 187) ---


bool __thiscall FUN_005bc6c0(int param_1,int *param_2,uint param_3)



{

  undefined4 *puVar1;

  uint uVar2;

  int iVar3;

  

  if (param_3 < 0x10) {

    return false;

  }

  puVar1 = (undefined4 *)*param_2;

  *(undefined4 *)(param_1 + 4) = *puVar1;

  iVar3 = *param_2;

  *param_2 = iVar3 + 4;

  *(undefined4 *)(param_1 + 8) = *(undefined4 *)(iVar3 + 4);

  iVar3 = *param_2;

  *param_2 = iVar3 + 4;

  *(undefined4 *)(param_1 + 0x74) = *(undefined4 *)(iVar3 + 4);

  iVar3 = *param_2;

  *param_2 = iVar3 + 4;

  *(undefined4 *)(param_1 + 0x78) = *(undefined4 *)(iVar3 + 4);

  iVar3 = *param_2;

  *param_2 = iVar3 + 4;

  uVar2 = (iVar3 + 4) - (int)puVar1;

  if (uVar2 < param_3) {

    iVar3 = param_3 - uVar2;

  }

  else {

    iVar3 = 0;

  }

  iVar3 = (**(code **)(*(int *)(param_1 + 0xc) + 0x10))(param_2,iVar3);

  if (iVar3 != 0) {

    if ((uint)(*param_2 - (int)puVar1) < param_3) {

      iVar3 = param_3 - (*param_2 - (int)puVar1);

    }

    else {

      iVar3 = 0;

    }

    iVar3 = (**(code **)(*(int *)(param_1 + 0x1c) + 0x10))(param_2,iVar3);

    if (iVar3 != 0) {

      if ((uint)(*param_2 - (int)puVar1) < param_3) {

        iVar3 = param_3 - (*param_2 - (int)puVar1);

      }

      else {

        iVar3 = 0;

      }

      iVar3 = (**(code **)(*(int *)(param_1 + 0x2c) + 0x10))(param_2,iVar3);

      return iVar3 != 0;

    }

  }

  return false;

}





// --- FUN_005bc780 at 0x005BC780 (size: 100) ---


undefined4 * __fastcall FUN_005bc780(undefined4 *param_1)



{

  *param_1 = &PTR_FUN_007e84f4;

  param_1[1] = 0;

  param_1[2] = 0;

  param_1[4] = 0;

  param_1[5] = 0;

  param_1[6] = 0;

  param_1[3] = &PTR_FUN_007e83bc;

  param_1[8] = 0;

  param_1[9] = 0;

  param_1[10] = 0;

  param_1[7] = &PTR_FUN_007e83bc;

  param_1[0xb] = &PTR_LAB_00797910;

  param_1[0xc] = 0;

  param_1[0xd] = 0x3f800000;

  param_1[0xe] = 0;

  param_1[0xf] = 0;

  param_1[0x10] = 0;

  param_1[0x1a] = 0;

  param_1[0x1b] = 0;

  param_1[0x1c] = 0;

  FUN_00535b30();

  param_1[0x1d] = 0;

  param_1[0x1e] = 0;

  return param_1;

}





// --- FUN_005bc7f0 at 0x005BC7F0 (size: 54) ---


undefined4 * __thiscall FUN_005bc7f0(undefined4 *param_1,byte param_2)



{

  param_1[0xb] = &PTR_FUN_0079385c;

  FUN_005bbfe0();

  FUN_005bbfe0();

  *param_1 = &PTR_FUN_0079385c;

  if ((param_2 & 1) != 0) {

    operator_delete(param_1);

  }

  return param_1;

}





// --- FUN_005bc830 at 0x005BC830 (size: 85) ---


int __thiscall FUN_005bc830(int param_1,int param_2)



{

  if (param_1 != param_2) {

    *(undefined4 *)(param_1 + 4) = *(undefined4 *)(param_2 + 4);

    *(undefined4 *)(param_1 + 8) = *(undefined4 *)(param_2 + 8);

    FUN_004a2df0(param_2 + 0xc);

    FUN_004a2df0(param_2 + 0x1c);

    *(undefined4 *)(param_1 + 0x30) = *(undefined4 *)(param_2 + 0x30);

    FUN_00425f10(param_2 + 0x34);

    *(undefined4 *)(param_1 + 0x74) = *(undefined4 *)(param_2 + 0x74);

    *(undefined4 *)(param_1 + 0x78) = *(undefined4 *)(param_2 + 0x78);

  }

  return param_1;

}





// --- FUN_005bc890 at 0x005BC890 (size: 100) ---


undefined4 * __thiscall FUN_005bc890(undefined4 *param_1,undefined4 param_2)



{

  *param_1 = &PTR_FUN_007e84f4;

  param_1[4] = 0;

  param_1[5] = 0;

  param_1[6] = 0;

  param_1[3] = &PTR_FUN_007e83bc;

  param_1[7] = &PTR_FUN_007e83bc;

  param_1[8] = 0;

  param_1[9] = 0;

  param_1[10] = 0;

  param_1[0xb] = &PTR_LAB_00797910;

  param_1[0xc] = 0;

  param_1[0xd] = 0x3f800000;

  param_1[0xe] = 0;

  param_1[0xf] = 0;

  param_1[0x10] = 0;

  param_1[0x1a] = 0;

  param_1[0x1b] = 0;

  param_1[0x1c] = 0;

  FUN_00535b30();

  FUN_005bc830(param_2);

  return param_1;

}





// --- FUN_005bc900 at 0x005BC900 (size: 35) ---


undefined4 __thiscall FUN_005bc900(int param_1,int param_2)



{

  undefined4 uVar1;

  

  if (param_2 == 1) {

    param_1 = param_1 + 0x14;

  }

  else {

    if (param_2 != 2) {

      return 0;

    }

    param_1 = param_1 + 0x24;

  }

  if (param_1 == 0) {

    return 0;

  }

  uVar1 = FUN_005bb7e0();

  return uVar1;

}





// --- FUN_005bc930 at 0x005BC930 (size: 40) ---


undefined4 __thiscall FUN_005bc930(int param_1,int param_2,undefined4 param_3)



{

  undefined4 uVar1;

  

  if (param_2 == 1) {

    param_1 = param_1 + 0x14;

  }

  else {

    if (param_2 != 2) {

      return 0;

    }

    param_1 = param_1 + 0x24;

  }

  if (param_1 == 0) {

    return 0;

  }

  uVar1 = FUN_005bbb90(param_3);

  return uVar1;

}





// --- FUN_005bc960 at 0x005BC960 (size: 40) ---


undefined4 __thiscall FUN_005bc960(int param_1,int param_2,undefined4 param_3)



{

  undefined4 uVar1;

  

  if (param_2 == 1) {

    param_1 = param_1 + 0x14;

  }

  else {

    if (param_2 != 2) {

      return 0;

    }

    param_1 = param_1 + 0x24;

  }

  if (param_1 == 0) {

    return 0;

  }

  uVar1 = FUN_005bb800(param_3);

  return uVar1;

}





// --- FUN_005bc990 at 0x005BC990 (size: 40) ---


undefined4 __thiscall FUN_005bc990(int param_1,int param_2,undefined4 param_3)



{

  undefined4 uVar1;

  

  if (param_2 == 1) {

    param_1 = param_1 + 0x14;

  }

  else {

    if (param_2 != 2) {

      return 0;

    }

    param_1 = param_1 + 0x24;

  }

  if (param_1 == 0) {

    return 0;

  }

  uVar1 = FUN_005bc210(param_3);

  return uVar1;

}





// --- FUN_005bc9c0 at 0x005BC9C0 (size: 40) ---


undefined4 __thiscall FUN_005bc9c0(int param_1,int param_2,undefined4 param_3)



{

  undefined4 uVar1;

  

  if (param_2 == 1) {

    param_1 = param_1 + 0x14;

  }

  else {

    if (param_2 != 2) {

      return 0;

    }

    param_1 = param_1 + 0x24;

  }

  if (param_1 == 0) {

    return 0;

  }

  uVar1 = FUN_005bc2a0(param_3);

  return uVar1;

}





// --- FUN_005bc9f0 at 0x005BC9F0 (size: 40) ---


undefined4 __thiscall FUN_005bc9f0(int param_1,int param_2,undefined4 param_3)



{

  undefined4 uVar1;

  

  if (param_2 == 1) {

    param_1 = param_1 + 0x14;

  }

  else {

    if (param_2 != 2) {

      return 0;

    }

    param_1 = param_1 + 0x24;

  }

  if (param_1 == 0) {

    return 0;

  }

  uVar1 = FUN_005bb8d0(param_3);

  return uVar1;

}





// --- FUN_005bcb30 at 0x005BCB30 (size: 155) ---


int __thiscall FUN_005bcb30(int param_1,int param_2)



{

  undefined4 *puVar1;

  int iVar2;

  LONG LVar3;

  

  if (param_1 != param_2) {

    *(undefined4 *)(param_1 + 4) = *(undefined4 *)(param_2 + 4);

    *(undefined4 *)(param_1 + 8) = *(undefined4 *)(param_2 + 8);

    *(undefined4 *)(param_1 + 0x10) = *(undefined4 *)(param_2 + 0x10);

    puVar1 = *(undefined4 **)(param_1 + 0xc);

    if (puVar1 != *(undefined4 **)(param_2 + 0xc)) {

      LVar3 = InterlockedDecrement(puVar1 + 1);

      if ((LVar3 == 0) && (puVar1 != (undefined4 *)0x0)) {

        (**(code **)*puVar1)(1);

      }

      iVar2 = *(int *)(param_2 + 0xc);

      *(int *)(param_1 + 0xc) = iVar2;

      InterlockedIncrement((LONG *)(iVar2 + 4));

    }

    FUN_004a2df0(param_2 + 0x14);

    FUN_004a2df0(param_2 + 0x24);

    *(undefined4 *)(param_1 + 0x34) = *(undefined4 *)(param_2 + 0x34);

    *(undefined4 *)(param_1 + 0x38) = *(undefined4 *)(param_2 + 0x38);

    *(undefined4 *)(param_1 + 0x3c) = *(undefined4 *)(param_2 + 0x3c);

    *(undefined4 *)(param_1 + 0x40) = *(undefined4 *)(param_2 + 0x40);

    *(undefined4 *)(param_1 + 0x44) = *(undefined4 *)(param_2 + 0x44);

    *(undefined4 *)(param_1 + 0x48) = *(undefined4 *)(param_2 + 0x48);

  }

  return param_1;

}





// --- FUN_005bcbd0 at 0x005BCBD0 (size: 386) ---


bool __thiscall FUN_005bcbd0(int param_1,uint param_2,int *param_3,uint param_4)



{

  undefined4 *puVar1;

  uint uVar2;

  undefined4 *puVar3;

  int iVar4;

  int *unaff_EDI;

  

  uVar2 = 0x14;

  if (param_2 != 0) {

    uVar2 = 0x1c;

  }

  if (1 < param_2) {

    uVar2 = uVar2 + 4;

  }

  if (2 < param_2) {

    uVar2 = uVar2 + 4;

  }

  if (param_4 < uVar2) {

    return false;

  }

  *(undefined4 *)(param_1 + 4) = 0;

  *(undefined4 *)(param_1 + 8) = 0;

  *(undefined4 *)(param_1 + 0x10) = 0;

  *(undefined4 *)(param_1 + 0x34) = 0xffffffff;

  *(undefined4 *)(param_1 + 0x38) = 0xffffffff;

  *(undefined4 *)(param_1 + 0x3c) = 0xffffffff;

  *(undefined4 *)(param_1 + 0x40) = 0xffffffff;

  FUN_004034c0(&DAT_007938af);

  *(undefined4 *)(param_1 + 0x44) = 0;

  *(undefined4 *)(param_1 + 0x48) = 0;

  FUN_004a2d40();

  FUN_004a2d40();

  puVar1 = (undefined4 *)*param_3;

  *(undefined4 *)(param_1 + 4) = *puVar1;

  iVar4 = *param_3;

  *param_3 = iVar4 + 4;

  *(undefined4 *)(param_1 + 8) = *(undefined4 *)(iVar4 + 4);

  iVar4 = *param_3;

  *param_3 = iVar4 + 4;

  *(undefined4 *)(param_1 + 0x10) = *(undefined4 *)(iVar4 + 4);

  iVar4 = *param_3;

  *param_3 = iVar4 + 4;

  *(undefined4 *)(param_1 + 0x34) = *(undefined4 *)(iVar4 + 4);

  iVar4 = *param_3;

  *param_3 = iVar4 + 4;

  *(undefined4 *)(param_1 + 0x38) = *(undefined4 *)(iVar4 + 4);

  puVar3 = (undefined4 *)(*param_3 + 4);

  *param_3 = (int)puVar3;

  if (param_2 != 0) {

    *(undefined4 *)(param_1 + 0x3c) = *puVar3;

    iVar4 = *param_3;

    *param_3 = iVar4 + 4;

    *(undefined4 *)(param_1 + 0x40) = *(undefined4 *)(iVar4 + 4);

    puVar3 = (undefined4 *)(*param_3 + 4);

    *param_3 = (int)puVar3;

  }

  if (1 < param_2) {

    *(undefined4 *)(param_1 + 0x44) = *puVar3;

    puVar3 = (undefined4 *)(*param_3 + 4);

    *param_3 = (int)puVar3;

  }

  if (2 < param_2) {

    *(undefined4 *)(param_1 + 0x48) = *puVar3;

    puVar3 = (undefined4 *)(*param_3 + 4);

    *param_3 = (int)puVar3;

  }

  if ((uint)((int)puVar3 - (int)puVar1) < param_4) {

    iVar4 = param_4 - ((int)puVar3 - (int)puVar1);

  }

  else {

    iVar4 = 0;

  }

  iVar4 = FUN_004fd460(param_3,iVar4);

  if (iVar4 != 0) {

    if ((uint)(*param_3 - (int)puVar1) < param_4) {

      iVar4 = param_4 - (*param_3 - (int)puVar1);

    }

    else {

      iVar4 = 0;

    }

    iVar4 = (**(code **)(*(int *)(param_1 + 0x14) + 0x10))(param_3,iVar4);

    if (iVar4 != 0) {

      if ((uint)(*param_3 - (int)puVar1) < param_4) {

        iVar4 = param_4 - (*param_3 - (int)puVar1);

      }

      else {

        iVar4 = 0;

      }

      iVar4 = (**(code **)(*unaff_EDI + 0x10))(param_3,iVar4);

      return iVar4 != 0;

    }

  }

  return false;

}





// --- FUN_005bcd60 at 0x005BCD60 (size: 96) ---


undefined4 * __fastcall FUN_005bcd60(undefined4 *param_1)



{

  LONG *lpAddend;

  

  *param_1 = &PTR_FUN_007e8540;

  param_1[1] = 0;

  param_1[2] = 0;

  lpAddend = (LONG *)(DAT_008ef11c + 4);

  param_1[3] = DAT_008ef11c;

  InterlockedIncrement(lpAddend);

  param_1[4] = 0;

  param_1[6] = 0;

  param_1[7] = 0;

  param_1[8] = 0;

  param_1[5] = &PTR_FUN_007e83bc;

  param_1[9] = &PTR_FUN_007e83bc;

  param_1[10] = 0;

  param_1[0xb] = 0;

  param_1[0xc] = 0;

  param_1[0x11] = 0;

  param_1[0x12] = 0;

  param_1[0xd] = 0xffffffff;

  param_1[0xe] = 0xffffffff;

  param_1[0xf] = 0xffffffff;

  param_1[0x10] = 0xffffffff;

  return param_1;

}





// --- FUN_005bcdc0 at 0x005BCDC0 (size: 30) ---


void * __thiscall FUN_005bcdc0(void *param_1,byte param_2)



{

  FUN_005bcde0();

  if ((param_2 & 1) != 0) {

    operator_delete(param_1);

  }

  return param_1;

}





// --- FUN_005bcde0 at 0x005BCDE0 (size: 86) ---


void __fastcall FUN_005bcde0(undefined4 *param_1)



{

  undefined4 *puVar1;

  LONG LVar2;

  

  param_1[9] = &PTR_FUN_007e83bc;

  FUN_004a2d40();

  param_1[9] = &PTR_FUN_0079385c;

  param_1[5] = &PTR_FUN_007e83bc;

  FUN_004a2d40();

  param_1[5] = &PTR_FUN_0079385c;

  puVar1 = (undefined4 *)param_1[3];

  LVar2 = InterlockedDecrement(puVar1 + 1);

  if ((LVar2 == 0) && (puVar1 != (undefined4 *)0x0)) {

    (**(code **)*puVar1)(1);

  }

  *param_1 = &PTR_FUN_0079385c;

  return;

}





// --- FUN_005bce40 at 0x005BCE40 (size: 78) ---


undefined4 * __thiscall FUN_005bce40(undefined4 *param_1,undefined4 param_2)



{

  LONG *lpAddend;

  

  *param_1 = &PTR_FUN_007e8540;

  lpAddend = (LONG *)(DAT_008ef11c + 4);

  param_1[3] = DAT_008ef11c;

  InterlockedIncrement(lpAddend);

  param_1[6] = 0;

  param_1[7] = 0;

  param_1[8] = 0;

  param_1[5] = &PTR_FUN_007e83bc;

  param_1[9] = &PTR_FUN_007e83bc;

  param_1[10] = 0;

  param_1[0xb] = 0;

  param_1[0xc] = 0;

  FUN_005bcb30(param_2);

  return param_1;

}





// --- FUN_005bce90 at 0x005BCE90 (size: 20) ---


void FUN_005bce90(undefined4 param_1,undefined4 param_2)



{

  FUN_005bcbd0(3,param_1,param_2);

  return;

}





// --- FUN_005bcf60 at 0x005BCF60 (size: 62) ---


void __fastcall FUN_005bcf60(int param_1)



{

  FUN_004034c0(&DAT_007938af);

  *(undefined4 *)(param_1 + 8) = 8;

  *(undefined4 *)(param_1 + 0xc) = DAT_008f0550;

  *(undefined4 *)(param_1 + 0x10) = 0;

  *(undefined4 *)(param_1 + 0x14) = 0;

  *(undefined4 *)(param_1 + 0x18) = 0;

  FUN_004034c0(&DAT_007938af);

  *(undefined4 *)(param_1 + 0x20) = 0;

  return;

}





// --- FUN_005bd070 at 0x005BD070 (size: 49) ---


undefined4 FUN_005bd070(undefined4 param_1)



{

  switch(param_1) {

  case 0x31:

  case 0x32:

  case 0x33:

  case 0x34:

  case 0x35:

  case 0x36:

  case 0x37:

  case 0x38:

  case 0x3c:

  case 0x3d:

  case 0x3e:

  case 0xbe:

    return 0x10;

  case 0x39:

    return 0x88b8f;

  default:

    return 0;

  case 0x3b:

    return 0x10010000;

  }

}





// --- FUN_005bd170 at 0x005BD170 (size: 87) ---


void __thiscall FUN_005bd170(int param_1,undefined4 *param_2)



{

  uint uVar1;

  int *piVar2;

  undefined4 uVar3;

  int iVar4;

  uint uVar5;

  int *piVar6;

  

  uVar1 = *(uint *)(param_1 + 0xc);

  uVar5 = 0;

  if (uVar1 != 0) {

    piVar2 = *(int **)(param_1 + 8);

    piVar6 = piVar2;

    do {

      if (*piVar6 != 0) {

        iVar4 = piVar2[uVar5];

        param_2[2] = piVar2;

        param_2[1] = iVar4;

        *param_2 = &PTR_LAB_007e8598;

        param_2[3] = uVar1;

        return;

      }

      uVar5 = uVar5 + 1;

      piVar6 = piVar6 + 1;

    } while (uVar5 < uVar1);

  }

  uVar3 = *(undefined4 *)(param_1 + 8);

  param_2[1] = 0;

  param_2[2] = uVar3;

  *param_2 = &PTR_LAB_007e8598;

  param_2[3] = uVar1;

  return;

}





// --- FUN_005bd260 at 0x005BD260 (size: 91) ---


int __fastcall FUN_005bd260(int param_1)



{

  int iVar1;

  int iVar2;

  uint uVar3;

  int iVar4;

  undefined4 local_4;

  

  uVar3 = 0;

  iVar4 = 4;

  local_4 = 0;

  if (*(int *)(param_1 + 0xc) != 0) {

    do {

      for (iVar1 = *(int *)(*(int *)(param_1 + 8) + uVar3 * 4); iVar1 != 0;

          iVar1 = *(int *)(iVar1 + 0x28)) {

        iVar2 = (**(code **)(*(int *)(iVar1 + 4) + 0xc))(&local_4,0);

        iVar4 = iVar4 + 4 + iVar2;

      }

      uVar3 = uVar3 + 1;

    } while (uVar3 < *(uint *)(param_1 + 0xc));

  }

  return iVar4;

}





// --- FUN_005bd2c0 at 0x005BD2C0 (size: 79) ---


undefined4 * FUN_005bd2c0(undefined4 *param_1,undefined4 param_2)



{

  int *piVar1;

  undefined4 local_4;

  

  piVar1 = (int *)FUN_00415730(4,0x10000001,0x28);

  local_4 = DAT_008f05d0;

  if (piVar1 != (int *)0x0) {

    FUN_00415c10(param_2,&local_4);

  }

  *param_1 = local_4;

  if (piVar1 != (int *)0x0) {

    (**(code **)(*piVar1 + 0x14))();

  }

  return param_1;

}





// --- FUN_005bd310 at 0x005BD310 (size: 68) ---


undefined4 FUN_005bd310(undefined4 param_1)



{

  undefined4 uVar1;

  int *piVar2;

  undefined4 local_4;

  

  piVar2 = (int *)FUN_00415730(3,0x10000001,0x28);

  local_4 = 0;

  FUN_00415ce0(param_1,&local_4);

  uVar1 = local_4;

  if (piVar2 != (int *)0x0) {

    (**(code **)(*piVar2 + 0x14))();

  }

  return uVar1;

}





// --- FUN_005bd360 at 0x005BD360 (size: 89) ---


undefined4 * __thiscall FUN_005bd360(undefined4 *param_1,int param_2)



{

  int iVar1;

  

  *param_1 = &PTR_LAB_007a441c;

  iVar1 = *(int *)(param_2 + 4);

  param_1[1] = iVar1;

  InterlockedIncrement((LONG *)(iVar1 + 4));

  param_1[2] = *(undefined4 *)(param_2 + 8);

  param_1[3] = *(undefined4 *)(param_2 + 0xc);

  param_1[4] = *(undefined4 *)(param_2 + 0x10);

  param_1[5] = *(undefined4 *)(param_2 + 0x14);

  param_1[6] = *(undefined4 *)(param_2 + 0x18);

  iVar1 = *(int *)(param_2 + 0x1c);

  param_1[7] = iVar1;

  InterlockedIncrement((LONG *)(iVar1 + 4));

  param_1[8] = *(undefined4 *)(param_2 + 0x20);

  return param_1;

}





// --- FUN_005bd3c0 at 0x005BD3C0 (size: 75) ---


undefined4 * FUN_005bd3c0(undefined4 *param_1,undefined4 param_2)



{

  int *piVar1;

  undefined4 local_4;

  

  piVar1 = (int *)FUN_00415730(3,0x10000001,0x28);

  local_4 = DAT_008f05d0;

  FUN_00415c10(param_2,&local_4);

  *param_1 = local_4;

  if (piVar1 != (int *)0x0) {

    (**(code **)(*piVar1 + 0x14))();

  }

  return param_1;

}





// --- FUN_005bd490 at 0x005BD490 (size: 184) ---


void __fastcall FUN_005bd490(int param_1)



{

  undefined4 *puVar1;

  void *pvVar2;

  void *pvVar3;

  LONG LVar4;

  uint local_8;

  

  if ((*(int *)(param_1 + 8) != 0) && (local_8 = 0, *(int *)(param_1 + 0xc) != 0)) {

    do {

      pvVar3 = *(void **)(*(int *)(param_1 + 8) + local_8 * 4);

      while (pvVar3 != (void *)0x0) {

        puVar1 = *(undefined4 **)((int)pvVar3 + 0x20);

        pvVar2 = *(void **)((int)pvVar3 + 0x28);

        LVar4 = InterlockedDecrement(puVar1 + 1);

        if ((LVar4 == 0) && (puVar1 != (undefined4 *)0x0)) {

          (**(code **)*puVar1)(1);

        }

        puVar1 = *(undefined4 **)((int)pvVar3 + 8);

        LVar4 = InterlockedDecrement(puVar1 + 1);

        if ((LVar4 == 0) && (puVar1 != (undefined4 *)0x0)) {

          (**(code **)*puVar1)(1);

        }

        *(undefined ***)((int)pvVar3 + 4) = &PTR_FUN_0079385c;

        operator_delete(pvVar3);

        pvVar3 = pvVar2;

      }

      *(undefined4 *)(*(int *)(param_1 + 8) + local_8 * 4) = 0;

      local_8 = local_8 + 1;

    } while (local_8 < *(uint *)(param_1 + 0xc));

  }

  *(undefined4 *)(param_1 + 0x10) = 0;

  return;

}





// --- FUN_005bd550 at 0x005BD550 (size: 155) ---


undefined4 __thiscall FUN_005bd550(int param_1,uint *param_2,undefined4 param_3)



{

  uint *puVar1;

  uint uVar2;

  

  if ((*(uint *)(param_1 + 0xc) != 0) && (*(int *)(param_1 + 8) != 0)) {

    for (puVar1 = *(uint **)(*(int *)(param_1 + 8) + (*param_2 % *(uint *)(param_1 + 0xc)) * 4);

        puVar1 != (uint *)0x0; puVar1 = (uint *)puVar1[10]) {

      if (*param_2 == *puVar1) {

        if (puVar1 != (uint *)0xfffffffc) {

          return 0;

        }

        break;

      }

    }

  }

  puVar1 = (uint *)FUN_005df0f5(0x30);

  if (puVar1 == (uint *)0x0) {

    return 0;

  }

  uVar2 = *(uint *)(param_1 + 0xc);

  *puVar1 = *param_2;

  FUN_005bd360(param_3);

  puVar1[10] = 0;

  uVar2 = *param_2 % uVar2;

  puVar1[0xb] = uVar2;

  puVar1[10] = *(uint *)(*(int *)(param_1 + 8) + uVar2 * 4);

  *(uint **)(*(int *)(param_1 + 8) + uVar2 * 4) = puVar1;

  *(int *)(param_1 + 0x10) = *(int *)(param_1 + 0x10) + 1;

  return 1;

}





// --- FUN_005bd5f0 at 0x005BD5F0 (size: 118) ---


int __thiscall FUN_005bd5f0(int param_1,int param_2)



{

  int iVar1;

  int iVar2;

  uint uVar3;

  

  if (param_1 != param_2) {

    FUN_005bd490();

    uVar3 = 0;

    if (*(void **)(param_1 + 8) != (void *)0x0) {

      operator_delete__(*(void **)(param_1 + 8));

      *(undefined4 *)(param_1 + 8) = 0;

    }

    *(undefined4 *)(param_1 + 0xc) = 0;

    *(undefined4 *)(param_1 + 0xc) = *(undefined4 *)(param_2 + 0xc);

    FUN_005a8440();

    if (*(int *)(param_2 + 0xc) != 0) {

      do {

        iVar2 = *(int *)(*(int *)(param_2 + 8) + uVar3 * 4);

        while (iVar2 != 0) {

          iVar1 = *(int *)(iVar2 + 0x28);

          FUN_005bd550(iVar2,iVar2 + 4);

          iVar2 = iVar1;

        }

        uVar3 = uVar3 + 1;

      } while (uVar3 < *(uint *)(param_2 + 0xc));

    }

  }

  return param_1;

}





// --- FUN_005bd670 at 0x005BD670 (size: 52) ---


void __fastcall FUN_005bd670(undefined4 *param_1)



{

  *param_1 = &PTR_FUN_007e859c;

  FUN_005bd490();

  if ((void *)param_1[2] != (void *)0x0) {

    operator_delete__((void *)param_1[2]);

    param_1[2] = 0;

  }

  param_1[3] = 0;

  *param_1 = &PTR_FUN_0079385c;

  return;

}





// --- FUN_005bd7f0 at 0x005BD7F0 (size: 72) ---


undefined4 * __thiscall FUN_005bd7f0(undefined4 *param_1,byte param_2)



{

  *param_1 = &PTR_FUN_007e859c;

  FUN_005bd490();

  if ((void *)param_1[2] != (void *)0x0) {

    operator_delete__((void *)param_1[2]);

    param_1[2] = 0;

  }

  param_1[3] = 0;

  *param_1 = &PTR_FUN_0079385c;

  if ((param_2 & 1) != 0) {

    operator_delete(param_1);

  }

  return param_1;

}





// --- FUN_005bd840 at 0x005BD840 (size: 166) ---


undefined4 * __thiscall FUN_005bd840(undefined4 *param_1,undefined4 param_2)



{

  undefined **local_14;

  undefined4 local_10;

  void *local_c;

  undefined4 local_8;

  undefined4 local_4;

  

  FUN_00415460(param_2);

  param_1[0xc] = &PTR_FUN_0079385c;

  *param_1 = &PTR_LAB_007e85c8;

  param_1[0xc] = &PTR_LAB_007e85b0;

  param_1[0xe] = &PTR_FUN_007e859c;

  param_1[0xf] = 0;

  param_1[0x10] = 0;

  param_1[0x11] = 0x20;

  param_1[0x12] = 0;

  FUN_005a8440();

  local_14 = &PTR_FUN_007e859c;

  local_10 = 0;

  local_c = (void *)0x0;

  local_8 = 0x100;

  local_4 = 0;

  FUN_005a8440();

  FUN_005bd5f0(&local_14);

  local_14 = &PTR_FUN_007e859c;

  FUN_005bd490();

  if (local_c != (void *)0x0) {

    operator_delete__(local_c);

  }

  return param_1;

}





// --- FUN_005bd900 at 0x005BD900 (size: 53) ---


undefined4 * __thiscall FUN_005bd900(undefined4 *param_1,byte param_2)



{

  *param_1 = &PTR_LAB_007e85c8;

  param_1[0xc] = &PTR_LAB_007e85b0;

  FUN_005bd670();

  FUN_004f8190();

  if ((param_2 & 1) != 0) {

    operator_delete(param_1);

  }

  return param_1;

}





// --- FUN_005bd950 at 0x005BD950 (size: 28) ---


undefined4 __fastcall FUN_005bd950(int *param_1)



{

  int iVar1;

  

  iVar1 = 0;

  do {

    param_1 = param_1 + 1;

    if (*param_1 == 0) {

      return 0;

    }

    iVar1 = iVar1 + 1;

  } while (iVar1 < 5);

  return 1;

}





// --- FUN_005bd970 at 0x005BD970 (size: 30) ---


undefined4 __thiscall FUN_005bd970(int param_1,int param_2,undefined4 param_3)



{

  if (7 < param_2) {

    return 0;

  }

  *(undefined4 *)(param_1 + 4 + param_2 * 4) = param_3;

  return 1;

}





// --- FUN_005bd990 at 0x005BD990 (size: 71) ---


char __fastcall FUN_005bd990(int param_1)



{

  char cVar1;

  

  cVar1 = *(int *)(param_1 + 4) != 0;

  if (*(int *)(param_1 + 8) != 0) {

    cVar1 = cVar1 + '\x01';

  }

  if (*(int *)(param_1 + 0xc) != 0) {

    cVar1 = cVar1 + '\x01';

  }

  if (*(int *)(param_1 + 0x10) != 0) {

    cVar1 = cVar1 + '\x01';

  }

  if (*(int *)(param_1 + 0x14) != 0) {

    cVar1 = cVar1 + '\x01';

  }

  if (*(int *)(param_1 + 0x18) != 0) {

    cVar1 = cVar1 + '\x01';

  }

  if (*(int *)(param_1 + 0x1c) != 0) {

    cVar1 = cVar1 + '\x01';

  }

  if (*(int *)(param_1 + 0x20) != 0) {

    cVar1 = cVar1 + '\x01';

  }

  return cVar1;

}





// --- FUN_005bd9e0 at 0x005BD9E0 (size: 35) ---


void __fastcall FUN_005bd9e0(int param_1)



{

  int iVar1;

  int *piVar2;

  

  iVar1 = 5;

  piVar2 = (int *)(param_1 + 0x18);

  do {

    if (*piVar2 == 0) break;

    iVar1 = iVar1 + 1;

    piVar2 = piVar2 + 1;

  } while (iVar1 < 8);

  FUN_005bd070(*(undefined4 *)(param_1 + iVar1 * 4));

  return;

}





// --- FUN_005bda10 at 0x005BDA10 (size: 13) ---


void __fastcall FUN_005bda10(int param_1)



{

  FUN_005be310(*(undefined4 *)(param_1 + 4));

  return;

}





// --- FUN_005bda20 at 0x005BDA20 (size: 145) ---


int __thiscall FUN_005bda20(int *param_1,uint *param_2)



{

  uint uVar1;

  uint uVar2;

  int iVar3;

  uint uVar4;

  

  iVar3 = 0;

  uVar4 = 0;

  uVar1 = (uint)(param_1[1] != 0);

  if (param_1[2] != 0) {

    uVar1 = uVar1 + 1;

  }

  if (param_1[3] != 0) {

    uVar1 = uVar1 + 1;

  }

  if (param_1[4] != 0) {

    uVar1 = uVar1 + 1;

  }

  if (param_1[5] != 0) {

    uVar1 = uVar1 + 1;

  }

  if (param_1[6] != 0) {

    uVar1 = uVar1 + 1;

  }

  if (param_1[7] != 0) {

    uVar1 = uVar1 + 1;

  }

  if (param_1[8] != 0) {

    uVar1 = uVar1 + 1;

  }

  if (uVar1 != 0) {

    do {

      param_1 = param_1 + 1;

      if ((*param_1 != 0) && (uVar2 = FUN_005be310(*param_1), uVar4 < uVar2)) {

        iVar3 = *param_1;

        uVar4 = uVar2;

      }

      uVar1 = uVar1 - 1;

    } while (uVar1 != 0);

    *param_2 = uVar4;

    return iVar3;

  }

  *param_2 = 0;

  return 0;

}





// --- FUN_005bdac0 at 0x005BDAC0 (size: 108) ---


undefined4 __thiscall FUN_005bdac0(int param_1,int param_2)



{

  if (*(int *)(param_1 + 4) != 0) {

    *(int *)(param_1 + 4) = *(int *)(param_1 + 4) - param_2;

  }

  if (*(int *)(param_1 + 8) != 0) {

    *(int *)(param_1 + 8) = *(int *)(param_1 + 8) - param_2;

  }

  if (*(int *)(param_1 + 0xc) != 0) {

    *(int *)(param_1 + 0xc) = *(int *)(param_1 + 0xc) - param_2;

  }

  if (*(int *)(param_1 + 0x10) != 0) {

    *(int *)(param_1 + 0x10) = *(int *)(param_1 + 0x10) - param_2;

  }

  if (*(int *)(param_1 + 0x14) != 0) {

    *(int *)(param_1 + 0x14) = *(int *)(param_1 + 0x14) - param_2;

  }

  if (*(int *)(param_1 + 0x18) != 0) {

    *(int *)(param_1 + 0x18) = *(int *)(param_1 + 0x18) - param_2;

  }

  if (*(int *)(param_1 + 0x1c) != 0) {

    *(int *)(param_1 + 0x1c) = *(int *)(param_1 + 0x1c) - param_2;

  }

  if (*(int *)(param_1 + 0x20) != 0) {

    *(int *)(param_1 + 0x20) = *(int *)(param_1 + 0x20) - param_2;

  }

  return 1;

}





// --- FUN_005bdc40 at 0x005BDC40 (size: 455) ---


undefined4 __thiscall FUN_005bdc40(int param_1,int *param_2)



{

  int iVar1;

  uint uVar2;

  int iVar3;

  uint uVar4;

  uint uVar5;

  int iVar6;

  int iVar7;

  int iVar8;

  int iVar9;

  byte bVar10;

  

  iVar8 = 0;

  bVar10 = *(int *)(param_1 + 4) != 0;

  if (*(int *)(param_1 + 8) != 0) {

    bVar10 = bVar10 + 1;

  }

  if (*(int *)(param_1 + 0xc) != 0) {

    bVar10 = bVar10 + 1;

  }

  if (*(int *)(param_1 + 0x10) != 0) {

    bVar10 = bVar10 + 1;

  }

  if (*(int *)(param_1 + 0x14) != 0) {

    bVar10 = bVar10 + 1;

  }

  if (*(int *)(param_1 + 0x18) != 0) {

    bVar10 = bVar10 + 1;

  }

  if (*(int *)(param_1 + 0x1c) != 0) {

    bVar10 = bVar10 + 1;

  }

  if (*(int *)(param_1 + 0x20) != 0) {

    bVar10 = bVar10 + 1;

  }

  iVar9 = *param_2;

  uVar2 = *(uint *)(iVar9 + 0x10);

  if (uVar2 == 0xffffffff) {

    uVar2 = FUN_004fe440();

    *(uint *)(iVar9 + 0x10) = uVar2;

  }

  iVar9 = *(int *)(param_1 + 4);

  iVar3 = 1;

  if (5 < bVar10) {

    iVar3 = 2;

  }

  iVar1 = *(int *)(param_1 + 4 + iVar3 * 4);

  uVar4 = iVar3 + 1;

  if (6 < bVar10) {

    uVar4 = iVar3 + 2;

  }

  if (uVar4 < 8) {

    param_2 = *(int **)(param_1 + 4 + uVar4 * 4);

  }

  else {

    param_2 = (int *)0x0;

  }

  if (uVar4 + 1 < 8) {

    iVar8 = *(int *)(param_1 + 4 + (uVar4 + 1) * 4);

  }

  uVar5 = uVar4 + 2;

  if (7 < bVar10) {

    uVar5 = uVar4 + 3;

  }

  if (uVar5 < 8) {

    iVar3 = *(int *)(param_1 + 4 + uVar5 * 4);

  }

  else {

    iVar3 = 0;

  }

  if (5 < bVar10) {

    if (iVar1 + iVar9 == 0) {

      iVar9 = 1;

    }

    iVar6 = FUN_005be460();

    *(uint *)(param_1 + 8) = iVar6 + (uint)(iVar3 + iVar1 * 2 + iVar8 + (int)param_2 + iVar9) % 0xc;

  }

  if (6 < bVar10) {

    iVar6 = iVar8 + (int)param_2;

    if (iVar9 + iVar6 == 0) {

      iVar9 = 1;

    }

    iVar7 = FUN_005be460();

    *(uint *)(param_1 + 0x10) =

         iVar7 + (((uVar2 % 0x13d573) / (uint)(iVar6 + iVar9)) * (iVar3 + iVar6 * 2 + iVar1 + iVar9)

                 ) % 0xc;

  }

  if (7 < bVar10) {

    if (iVar3 + iVar9 == 0) {

      iVar9 = 1;

    }

    iVar6 = FUN_005be460();

    *(uint *)(param_1 + 0x1c) =

         iVar6 + (((uVar2 % 0x13d573) / (uint)(iVar3 + iVar9)) *

                 (iVar8 + iVar3 * 2 + (int)param_2 + iVar1 + iVar9)) % 0xc;

  }

  return 1;

}





// --- FUN_005bde10 at 0x005BDE10 (size: 212) ---


undefined4 __thiscall FUN_005bde10(int param_1,int *param_2)



{

  int iVar1;

  int iVar2;

  int iVar3;

  int iVar4;

  int iVar5;

  int iVar6;

  uint uVar7;

  int iVar8;

  

  iVar1 = *param_2;

  uVar7 = *(uint *)(iVar1 + 0x10);

  if (uVar7 == 0xffffffff) {

    uVar7 = FUN_004fe440();

    *(uint *)(iVar1 + 0x10) = uVar7;

  }

  iVar1 = *(int *)(param_1 + 4);

  iVar2 = *(int *)(param_1 + 0x18);

  iVar3 = *(int *)(param_1 + 0x20);

  iVar4 = *(int *)(param_1 + 8);

  iVar5 = *(int *)(param_1 + 0xc);

  iVar6 = *(int *)(param_1 + 0x14);

  iVar8 = FUN_005be460();

  *(uint *)(param_1 + 0x10) =

       iVar8 + (uint)(iVar3 + iVar1 + iVar1 * 2 + iVar2 * iVar6 * 2 + iVar5 + iVar4) % 0xc;

  iVar8 = FUN_005be460();

  *(uint *)(param_1 + 0x1c) =

       iVar8 + (uint)((int)(((ulonglong)uVar7 % 0x13d573) /

                           (ulonglong)(uint)(iVar3 * iVar4 + iVar6 * 2)) *

                     (iVar3 + iVar5 * iVar1 * 3 + iVar2 * 2 + iVar6)) % 0xc;

  return 1;

}





// --- FUN_005bdef0 at 0x005BDEF0 (size: 560) ---


undefined4 __thiscall FUN_005bdef0(int param_1,int *param_2)



{

  uint uVar1;

  uint uVar2;

  uint uVar3;

  uint uVar4;

  uint uVar5;

  uint uVar6;

  uint uVar7;

  int iVar8;

  int iVar9;

  

  iVar8 = *param_2;

  uVar1 = *(uint *)(iVar8 + 0x10);

  if (uVar1 == 0xffffffff) {

    uVar1 = FUN_004fe440();

    *(uint *)(iVar8 + 0x10) = uVar1;

  }

  iVar8 = *param_2;

  uVar2 = *(uint *)(iVar8 + 0x10);

  if (uVar2 == 0xffffffff) {

    uVar2 = FUN_004fe440();

    *(uint *)(iVar8 + 0x10) = uVar2;

  }

  iVar8 = *param_2;

  uVar3 = *(uint *)(iVar8 + 0x10);

  if (uVar3 == 0xffffffff) {

    uVar3 = FUN_004fe440();

    *(uint *)(iVar8 + 0x10) = uVar3;

  }

  iVar8 = *param_2;

  uVar4 = *(uint *)(iVar8 + 0x10);

  if (uVar4 == 0xffffffff) {

    uVar4 = FUN_004fe440();

    *(uint *)(iVar8 + 0x10) = uVar4;

  }

  iVar8 = *param_2;

  uVar5 = *(uint *)(iVar8 + 0x10);

  if (uVar5 == 0xffffffff) {

    uVar5 = FUN_004fe440();

    *(uint *)(iVar8 + 0x10) = uVar5;

  }

  iVar8 = *param_2;

  uVar6 = *(uint *)(iVar8 + 0x10);

  if (uVar6 == 0xffffffff) {

    uVar6 = FUN_004fe440();

    *(uint *)(iVar8 + 0x10) = uVar6;

  }

  iVar8 = *param_2;

  uVar7 = *(uint *)(iVar8 + 0x10);

  if (uVar7 == 0xffffffff) {

    uVar7 = FUN_004fe440();

    *(uint *)(iVar8 + 0x10) = uVar7;

  }

  uVar1 = (*(int *)(param_1 + 4) + uVar1 % 0x13d573) % 0xc;

  uVar2 = (*(int *)(param_1 + 8) + uVar2 % 0x4aefd) % 0xc;

  uVar3 = (*(int *)(param_1 + 0xc) + uVar3 % 0x96a7f) % 0xc;

  uVar4 = (*(int *)(param_1 + 0x14) + uVar4 % 0x100a03) % 0xc;

  uVar5 = (*(int *)(param_1 + 0x18) + uVar5 % 0xeb2ef) % 0xc;

  uVar6 = (*(int *)(param_1 + 0x20) + uVar6 % 0x121e7d) % 0xc;

  iVar9 = uVar5 * uVar3;

  iVar8 = FUN_005be460();

  *(uint *)(param_1 + 0x10) =

       iVar8 + ((uVar4 + 1) * uVar6 + uVar2 * uVar1 + iVar9 + uVar5 + uVar4 + uVar3 + uVar2 + uVar1)

               % 0xc;

  iVar8 = FUN_005be460();

  *(uint *)(param_1 + 0x1c) =

       iVar8 + (iVar9 * 0xb +

                uVar5 + uVar2 * uVar1 * 5 +

                ((iVar9 * uVar2 * uVar1 + 7) * uVar4 + 1) * uVar6 +

                (int)(((ulonglong)uVar7 % 0x65039) % 0xc) + uVar4 + uVar3 + uVar2 + uVar1) % 0xc;

  return 1;

}





// --- FUN_005be120 at 0x005BE120 (size: 57) ---


undefined4 FUN_005be120(undefined4 param_1,int param_2)



{

  undefined4 uVar1;

  

  if (param_2 == 1) {

    uVar1 = FUN_005bdc40(param_1);

    return uVar1;

  }

  if (param_2 != 2) {

    if (param_2 != 3) {

      return 0;

    }

    uVar1 = FUN_005bdef0(param_1);

    return uVar1;

  }

  uVar1 = FUN_005bde10(param_1);

  return uVar1;

}





// --- FUN_005be1c0 at 0x005BE1C0 (size: 52) ---


uint __thiscall FUN_005be1c0(int *param_1,int *param_2,uint param_3)



{

  uint uVar1;

  

  uVar1 = (**(code **)(*param_1 + 8))();

  if (uVar1 <= param_3) {

    *(int *)*param_2 = param_1[1];

    *param_2 = *param_2 + 4;

    (**(code **)(param_1[6] + 0xc))(param_2,param_3);

  }

  return uVar1;

}





// --- FUN_005be200 at 0x005BE200 (size: 55) ---


undefined4 __thiscall FUN_005be200(int *param_1,int *param_2,uint param_3)



{

  uint uVar1;

  

  uVar1 = (**(code **)(*param_1 + 8))();

  if (param_3 < uVar1) {

    return 0;

  }

  param_1[1] = *(int *)*param_2;

  *param_2 = *param_2 + 4;

  (**(code **)(param_1[6] + 0x10))(param_2,param_3);

  return 1;

}





// --- FUN_005be260 at 0x005BE260 (size: 41) ---


uint __thiscall FUN_005be260(int *param_1,undefined4 param_2,uint param_3)



{

  uint uVar1;

  

  uVar1 = (**(code **)(*param_1 + 8))();

  if (uVar1 <= param_3) {

    (**(code **)(param_1[5] + 0xc))(param_2,param_3);

  }

  return uVar1;

}





// --- FUN_005be290 at 0x005BE290 (size: 46) ---


undefined4 __thiscall FUN_005be290(int *param_1,undefined4 param_2,uint param_3)



{

  uint uVar1;

  

  uVar1 = (**(code **)(*param_1 + 8))();

  if (param_3 < uVar1) {

    return 0;

  }

  (**(code **)(param_1[5] + 0x10))(param_2,param_3);

  return 1;

}





// --- FUN_005be2c0 at 0x005BE2C0 (size: 68) ---


undefined4 * __thiscall FUN_005be2c0(undefined4 *param_1,int param_2)



{

  *param_1 = &PTR_FUN_007e5950;

  param_1[3] = 0;

  param_1[4] = 0;

  param_1[5] = 0;

  param_1[6] = &PTR_FUN_0079385c;

  param_1[2] = &PTR_FUN_007a83d8;

  param_1[6] = &PTR_LAB_007a5164;

  param_1[1] = *(undefined4 *)(param_2 + 4);

  FUN_004db900(param_2 + 8);

  return param_1;

}





// --- FUN_005be310 at 0x005BE310 (size: 89) ---


undefined4 FUN_005be310(undefined4 param_1)



{

  undefined4 uVar1;

  

  uVar1 = 0;

  switch(param_1) {

  case 1:

    return 1;

  case 2:

    return 2;

  case 3:

    return 3;

  case 4:

    return 4;

  case 5:

    return 5;

  case 6:

    return 6;

  case 0x6e:

    return 7;

  case 0x70:

    return 8;

  case 0xc0:

    return 9;

  case 0xc1:

    uVar1 = 10;

  }

  return uVar1;

}





// --- FUN_005be460 at 0x005BE460 (size: 6) ---


undefined4 FUN_005be460(void)



{

  return 0x3f;

}





// --- FUN_005be470 at 0x005BE470 (size: 18) ---


undefined4 * __fastcall FUN_005be470(undefined4 *param_1)



{

  FUN_006b3c10();

  *param_1 = &PTR_FUN_007e86c0;

  return param_1;

}





// --- FUN_005be490 at 0x005BE490 (size: 36) ---


undefined4 * __thiscall FUN_005be490(undefined4 *param_1,byte param_2)



{

  *param_1 = &PTR_FUN_007e86c0;

  FUN_006b3b90();

  if ((param_2 & 1) != 0) {

    operator_delete(param_1);

  }

  return param_1;

}





// --- FUN_005be4c0 at 0x005BE4C0 (size: 36) ---


undefined4 * __thiscall FUN_005be4c0(undefined4 *param_1,byte param_2)



{

  *param_1 = &PTR_LAB_007e8720;

  FUN_004154b0();

  if ((param_2 & 1) != 0) {

    operator_delete(param_1);

  }

  return param_1;

}





// --- FUN_005be510 at 0x005BE510 (size: 198) ---


void FUN_005be510(int param_1,int *param_2,int param_3)



{

  undefined1 uVar1;

  undefined4 uVar2;

  int iVar3;

  undefined4 uVar4;

  undefined4 uVar5;

  int iVar6;

  

  iVar3 = param_3;

  uVar1 = FUN_0040aa60();

  param_3 = CONCAT31(param_3._1_3_,uVar1);

  FUN_0040aa30(1);

  FUN_0040ad10(4);

  FUN_0040aa30(param_3);

  if ((*(byte *)(iVar3 + 4) & 1) == 0) {

    uVar4 = FUN_0040a8f0();

    uVar2 = uVar4;

    uVar5 = FUN_0040a8d0(uVar4);

    iVar3 = FUN_0040ac70(uVar5,uVar2);

    param_3 = iVar3;

    iVar6 = (**(code **)(*param_2 + 0x10))(&param_3,uVar4);

    if (iVar6 != 0) {

      FUN_0040acf0(param_1 - iVar3);

      return;

    }

    FUN_0040aa50();

  }

  else {

    param_3 = 0;

    uVar2 = (**(code **)(*param_2 + 0xc))(&param_3,0);

    iVar3 = FUN_0040acf0(uVar2);

    if (iVar3 != 0) {

      (**(code **)(*param_2 + 0xc))(&stack0xfffffff4,uVar2);

      return;

    }

  }

  return;

}





// --- FUN_005be5e0 at 0x005BE5E0 (size: 51) ---


int __thiscall FUN_005be5e0(int param_1,int param_2)



{

  *(undefined4 *)(param_1 + 4) = *(undefined4 *)(param_2 + 4);

  *(undefined4 *)(param_1 + 8) = *(undefined4 *)(param_2 + 8);

  FUN_005ad300(param_2 + 0xc);

  FUN_005ad300(param_2 + 0x38);

  return param_1;

}





// --- FUN_005be620 at 0x005BE620 (size: 124) ---


void __fastcall FUN_005be620(int *param_1)



{

  undefined4 *puVar1;

  uint uVar2;

  int iVar3;

  int iVar4;

  

  param_1[2] = 0;

  if ((param_1[1] & 0x80000000U) != 0x80000000) {

    if (*param_1 != 0) {

      uVar2 = param_1[1] & 0x7fffffff;

      if (-1 < (int)(uVar2 - 1)) {

        iVar4 = (uVar2 - 1) * 0x10;

        do {

          iVar3 = *param_1 + iVar4;

          iVar4 = iVar4 + -0x10;

          uVar2 = uVar2 - 1;

          *(undefined4 *)(iVar3 + 4) = 0;

          *(undefined4 *)(iVar3 + 8) = 0;

          *(undefined4 *)(iVar3 + 0xc) = 0;

        } while (uVar2 != 0);

      }

    }

    return;

  }

  iVar4 = *param_1;

  if (iVar4 != 0) {

    iVar3 = *(int *)(iVar4 + -4);

    puVar1 = (undefined4 *)(iVar3 * 0x10 + iVar4);

    if (-1 < iVar3 + -1) {

      do {

        puVar1 = puVar1 + -4;

        iVar3 = iVar3 + -1;

        *puVar1 = &PTR_FUN_007a0acc;

      } while (iVar3 != 0);

    }

    operator_delete__((void *)(iVar4 + -4));

  }

  *param_1 = 0;

  param_1[1] = 0;

  return;

}





// --- FUN_005be6a0 at 0x005BE6A0 (size: 922) ---


void FUN_005be6a0(char *param_1)



{

  char cVar1;

  byte bVar2;

  uint uVar3;

  bool bVar4;

  char *pcVar5;

  uint *puVar6;

  byte bVar7;

  byte bVar8;

  int iVar9;

  int iVar10;

  int iVar11;

  char *_Str2;

  int local_90;

  uint local_8c;

  uint local_88 [34];

  

  iVar10 = 0;

  local_90 = 0;

  pcVar5 = param_1;

  do {

    cVar1 = *pcVar5;

    pcVar5 = pcVar5 + 1;

  } while (cVar1 != '\0');

  for (pcVar5 = pcVar5 + (-1 - (int)(param_1 + 1));

      (-1 < (int)pcVar5 && (param_1[(int)pcVar5] == ' ')); pcVar5 = pcVar5 + -1) {

    param_1[(int)pcVar5] = '\0';

  }

  local_8c = 0x20;

  pcVar5 = param_1;

  do {

    cVar1 = *pcVar5;

    pcVar5 = pcVar5 + 1;

  } while (cVar1 != '\0');

  local_88[0] = (int)pcVar5 - (int)(param_1 + 1);

  puVar6 = &local_8c;

  if ((uint)((int)pcVar5 - (int)(param_1 + 1)) < 0x21) {

    puVar6 = local_88;

  }

  local_8c = *puVar6;

  bVar7 = 0;

  iVar9 = 0;

  if (0 < (int)local_8c) {

    do {

      bVar2 = param_1[iVar9];

      if (iVar9 < (int)(local_8c - 1)) {

        bVar8 = param_1[iVar9 + 1];

      }

      else {

        bVar8 = 0;

      }

      bVar4 = true;

      if (((((char)bVar2 < 'a') || ('z' < (char)bVar2)) &&

          (((char)bVar2 < 'A' || ('Z' < (char)bVar2)))) && (bVar2 != 0x27)) {

        if (bVar2 != 0x20) {

          if (bVar2 != 0x2d) {

            bVar4 = false;

          }

          goto LAB_005be760;

        }

LAB_005be765:

        if ((bVar7 == 0x20) || (bVar7 == 0)) {

          bVar4 = false;

        }

        if (bVar8 == 0) {

          bVar4 = false;

        }

      }

      else {

LAB_005be760:

        if (bVar2 == 0x20) goto LAB_005be765;

      }

      if (bVar2 == 0x27) {

        if (bVar7 == 0x27) {

          bVar4 = false;

        }

        else if (bVar7 == 0) {

          bVar4 = false;

        }

        else if (((('`' < (char)bVar7) && ((char)bVar7 < '{')) ||

                 (('@' < (char)bVar7 && ((char)bVar7 < '[')))) || (0x7f < bVar7)) goto LAB_005be7fc;

        if ((('`' < (char)bVar8) && ((char)bVar8 < '{')) ||

           ((('@' < (char)bVar8 && ((char)bVar8 < '[')) || (0x7f < bVar8)))) goto LAB_005be7fc;

      }

      else {

        if (bVar2 == 0x2d) {

          if (bVar7 == 0x2d) {

            bVar4 = false;

          }

          else if ((bVar7 == 0) ||

                  (((((char)bVar7 < 'a' || ('z' < (char)bVar7)) &&

                    (((char)bVar7 < 'A' || ('Z' < (char)bVar7)))) && (bVar7 < 0x80))))

          goto LAB_005be804;

          if ((((char)bVar8 < 'a') || ('z' < (char)bVar8)) &&

             ((((char)bVar8 < 'A' || ('Z' < (char)bVar8)) && ((bVar8 < 0x80 && (bVar8 != 0x2d))))))

          goto LAB_005be804;

        }

LAB_005be7fc:

        if (bVar4) {

          param_1[iVar10] = bVar2;

          iVar10 = iVar10 + 1;

        }

      }

LAB_005be804:

      iVar9 = iVar9 + 1;

      local_90 = iVar10;

      bVar7 = bVar2;

    } while (iVar9 < (int)local_8c);

  }

  param_1[local_90] = '\0';

  local_88[1] = 0;

  if (1 < local_90) {

    puVar6 = local_88 + 2;

    iVar10 = local_90;

    while (iVar10 = iVar10 + -1, iVar10 != 0) {

      *puVar6 = 1;

      puVar6 = puVar6 + 1;

    }

  }

  iVar10 = -1;

  if (-1 < local_90 + -1) {

    do {

      if (iVar10 != -1) {

        cVar1 = param_1[iVar10];

        if (((cVar1 == '-') || (cVar1 == '\'')) || (cVar1 == ' ')) {

          if (-1 < iVar10) {

            local_88[iVar10 + 2] = 2;

          }

          goto LAB_005be878;

        }

        goto switchD_005be89b_caseD_45;

      }

LAB_005be878:

      pcVar5 = param_1 + iVar10 + 1;

      switch(param_1[iVar10 + 1]) {

      case 'D':

      case 'd':

        iVar9 = _strnicmp(pcVar5,"De",2);

        if (iVar9 == 0) {

          local_88[iVar10 + 4] = 2;

        }

        iVar9 = _strnicmp(pcVar5,"Di",2);

        if (iVar9 == 0) {

          local_88[iVar10 + 4] = 2;

        }

        _Str2 = "Du";

        goto LAB_005be956;

      case 'F':

      case 'f':

        iVar9 = _strnicmp(pcVar5,"Fitz",4);

        if (iVar9 == 0) {

          local_88[iVar10 + 6] = 2;

        }

        break;

      case 'L':

      case 'l':

        iVar9 = _strnicmp(pcVar5,"Le",2);

        if (iVar9 == 0) {

          local_88[iVar10 + 4] = 2;

        }

        _Str2 = "La";

        goto LAB_005be956;

      case 'M':

      case 'm':

        iVar9 = _strnicmp(pcVar5,"Mac",3);

        if (iVar9 == 0) {

          local_88[iVar10 + 5] = 2;

        }

        _Str2 = "Mc";

LAB_005be956:

        iVar9 = _strnicmp(pcVar5,_Str2,2);

        if (iVar9 == 0) {

          local_88[iVar10 + 4] = 2;

        }

        break;

      case 'V':

      case 'v':

        iVar9 = _strnicmp(pcVar5,"Von",3);

        if (iVar9 == 0) {

          local_88[iVar10 + 5] = 2;

        }

        iVar9 = _strnicmp(pcVar5,"Van",3);

        if (iVar9 == 0) {

          local_88[iVar10 + 5] = 2;

        }

      }

switchD_005be89b_caseD_45:

      iVar10 = iVar10 + 1;

    } while (iVar10 < local_90 + -1);

  }

  iVar9 = -1;

  iVar10 = -1;

  iVar11 = 0;

  bVar4 = true;

  if (0 < local_90) {

    do {

      bVar7 = param_1[iVar11];

      if (((((char)bVar7 < 'a') || ('z' < (char)bVar7)) &&

          (((char)bVar7 < 'A' || ('Z' < (char)bVar7)))) && (bVar7 < 0x80)) {

LAB_005be9c5:

        if (((iVar9 != -1) && (bVar4)) && (iVar9 <= iVar10)) {

          puVar6 = local_88 + iVar9 + 1;

          for (iVar10 = (iVar10 - iVar9) + 1; iVar10 != 0; iVar10 = iVar10 + -1) {

            *puVar6 = 0;

            puVar6 = puVar6 + 1;

          }

        }

        iVar10 = -1;

        bVar4 = true;

        iVar9 = -1;

      }

      else {

        if (iVar9 == -1) {

          iVar9 = iVar11;

        }

        if (((bVar7 != 0x49) && (bVar7 != 0x56)) && (bVar7 != 0x58)) {

          bVar4 = false;

        }

        iVar10 = iVar11;

        if (iVar11 == local_90 + -1) goto LAB_005be9c5;

      }

      iVar11 = iVar11 + 1;

    } while (iVar11 < local_90);

  }

  iVar10 = 0;

  if (0 < local_90) {

    do {

      uVar3 = local_88[iVar10 + 1];

      if (((uVar3 == 1) && (cVar1 = param_1[iVar10], '@' < cVar1)) && (cVar1 < '[')) {

        param_1[iVar10] = cVar1 + ' ';

      }

      if (((uVar3 == 0) && (cVar1 = param_1[iVar10], '`' < cVar1)) && (cVar1 < '{')) {

        param_1[iVar10] = cVar1 + -0x20;

      }

      iVar10 = iVar10 + 1;

    } while (iVar10 < local_90);

  }

  return;

}





// --- FUN_005bea90 at 0x005BEA90 (size: 136) ---


void __thiscall FUN_005bea90(int param_1,int param_2)



{

  undefined4 *puVar1;

  

  FUN_0040ad10(4);

  puVar1 = (undefined4 *)FUN_0040acf0(4);

  if (puVar1 != (undefined4 *)0x0) {

    if ((*(byte *)(param_2 + 4) & 1) == 0) {

      *(undefined4 *)(param_1 + 4) = *puVar1;

    }

    else {

      *puVar1 = *(undefined4 *)(param_1 + 4);

    }

  }

  FUN_0040ad10(4);

  puVar1 = (undefined4 *)FUN_0040acf0(4);

  if (puVar1 != (undefined4 *)0x0) {

    if ((*(byte *)(param_2 + 4) & 1) == 0) {

      *(undefined4 *)(param_1 + 8) = *puVar1;

    }

    else {

      *puVar1 = *(undefined4 *)(param_1 + 8);

    }

  }

  FUN_0040ad10(4);

  puVar1 = (undefined4 *)FUN_0040acf0(4);

  if (puVar1 != (undefined4 *)0x0) {

    if ((*(byte *)(param_2 + 4) & 1) != 0) {

      *puVar1 = *(undefined4 *)(param_1 + 0xc);

      return;

    }

    *(undefined4 *)(param_1 + 0xc) = *puVar1;

  }

  return;

}





// --- FUN_005beb20 at 0x005BEB20 (size: 42) ---


undefined4 * __fastcall FUN_005beb20(undefined4 *param_1)



{

  *param_1 = &PTR_FUN_007a0ad0;

  param_1[1] = DAT_008f0874;

  *(undefined1 *)(param_1 + 2) = 0;

  param_1[3] = DAT_008f0874;

  FUN_005ac9c0();

  return param_1;

}





// --- FUN_005beb50 at 0x005BEB50 (size: 124) ---


void __thiscall FUN_005beb50(int param_1,int param_2)



{

  int iVar1;

  undefined4 *puVar2;

  

  iVar1 = param_2;

  FUN_0040ad10(4);

  puVar2 = (undefined4 *)FUN_0040acf0(4);

  if (puVar2 != (undefined4 *)0x0) {

    if ((*(byte *)(iVar1 + 4) & 1) == 0) {

      *(undefined4 *)(param_1 + 4) = *puVar2;

    }

    else {

      *puVar2 = *(undefined4 *)(param_1 + 4);

    }

  }

  FUN_00422250(param_1 + 8,iVar1);

  FUN_0040ad10(4);

  puVar2 = (undefined4 *)FUN_0040acf0(4);

  if (puVar2 != (undefined4 *)0x0) {

    if ((*(byte *)(iVar1 + 4) & 1) == 0) {

      *(undefined4 *)(param_1 + 0xc) = *puVar2;

    }

    else {

      *puVar2 = *(undefined4 *)(param_1 + 0xc);

    }

  }

  FUN_005be510(&param_2,param_1 + 0x10,iVar1);

  return;

}





// --- FUN_005bebd0 at 0x005BEBD0 (size: 46) ---


undefined4 * __fastcall FUN_005bebd0(undefined4 *param_1)



{

  *param_1 = &PTR_FUN_007a0ad4;

  param_1[1] = DAT_008f0874;

  param_1[2] = DAT_008f0874;

  FUN_005ac9c0();

  FUN_005ac9c0();

  return param_1;

}





// --- FUN_005bec00 at 0x005BEC00 (size: 126) ---


void __thiscall FUN_005bec00(int param_1,int param_2)



{

  int iVar1;

  undefined4 *puVar2;

  

  iVar1 = param_2;

  FUN_0040ad10(4);

  puVar2 = (undefined4 *)FUN_0040acf0(4);

  if (puVar2 != (undefined4 *)0x0) {

    if ((*(byte *)(iVar1 + 4) & 1) == 0) {

      *(undefined4 *)(param_1 + 4) = *puVar2;

    }

    else {

      *puVar2 = *(undefined4 *)(param_1 + 4);

    }

  }

  FUN_0040ad10(4);

  puVar2 = (undefined4 *)FUN_0040acf0(4);

  if (puVar2 != (undefined4 *)0x0) {

    if ((*(byte *)(iVar1 + 4) & 1) == 0) {

      *(undefined4 *)(param_1 + 8) = *puVar2;

    }

    else {

      *puVar2 = *(undefined4 *)(param_1 + 8);

    }

  }

  FUN_005be510(&param_2,param_1 + 0xc,iVar1);

  FUN_005be510(&param_2,param_1 + 0x38,iVar1);

  return;

}





// --- FUN_005bec80 at 0x005BEC80 (size: 29) ---


undefined4 * __fastcall FUN_005bec80(undefined4 *param_1)



{

  *param_1 = &PTR_LAB_007a0ad8;

  param_1[1] = DAT_008f0874;

  FUN_005ac9c0();

  return param_1;

}





// --- FUN_005becf0 at 0x005BECF0 (size: 64) ---


undefined4 * __thiscall FUN_005becf0(undefined4 *param_1,byte param_2)



{

  *param_1 = &PTR_FUN_007e87a8;

  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_005bed30 at 0x005BED30 (size: 82) ---


int __thiscall FUN_005bed30(int param_1,int param_2)



{

  int iVar1;

  LONG LVar2;

  

  iVar1 = *(int *)(param_1 + 4);

  if (iVar1 != *(int *)(param_2 + 4)) {

    LVar2 = InterlockedDecrement((LONG *)(iVar1 + -0x10));

    if ((LVar2 == 0) && ((undefined4 *)(iVar1 + -0x14) != (undefined4 *)0x0)) {

      (*(code *)**(undefined4 **)(iVar1 + -0x14))(1);

    }

    iVar1 = *(int *)(param_2 + 4);

    *(int *)(param_1 + 4) = iVar1;

    InterlockedIncrement((LONG *)(iVar1 + -0x10));

  }

  *(undefined4 *)(param_1 + 8) = *(undefined4 *)(param_2 + 8);

  *(undefined4 *)(param_1 + 0xc) = *(undefined4 *)(param_2 + 0xc);

  return param_1;

}





// --- FUN_005bed90 at 0x005BED90 (size: 232) ---


undefined4 __fastcall FUN_005bed90(int *param_1)



{

  uint uVar1;

  undefined4 *puVar2;

  int iVar3;

  uint *puVar4;

  int iVar5;

  uint *local_4;

  

  uVar1 = param_1[2];

  if (uVar1 == (param_1[1] & 0x7fffffffU)) {

    return 0;

  }

  if (uVar1 == 0) {

    local_4 = (uint *)0x0;

LAB_005bee30:

    if (((param_1[1] & 0x80000000U) == 0x80000000) &&

       (puVar2 = (undefined4 *)*param_1, puVar2 != (undefined4 *)0x0)) {

      if (puVar2[-1] == 0) {

        operator_delete__(puVar2 + -1);

      }

      else {

        (**(code **)*puVar2)(3);

      }

    }

    *param_1 = (int)local_4;

    param_1[1] = param_1[2] | 0x80000000;

    return 1;

  }

  puVar4 = (uint *)thunk_FUN_005df0f5(uVar1 * 0x48 + 4);

  if (puVar4 != (uint *)0x0) {

    local_4 = puVar4 + 1;

    *puVar4 = uVar1;

    FUN_00401000(local_4,0x48,uVar1,FUN_00424d10);

    if (local_4 != (uint *)0x0) {

      iVar5 = param_1[2];

      if (-1 < iVar5 + -1) {

        puVar4 = puVar4 + (iVar5 + -1) * 0x12 + 3;

        do {

          iVar3 = *param_1 + (-8 - (int)local_4);

          puVar4[-1] = *(uint *)((int)puVar4 + iVar3 + 4);

          FUN_00425f10((int)puVar4 + iVar3 + 8);

          puVar4 = puVar4 + -0x12;

          iVar5 = iVar5 + -1;

        } while (iVar5 != 0);

      }

      goto LAB_005bee30;

    }

  }

  return 0;

}





// --- FUN_005bee80 at 0x005BEE80 (size: 259) ---


undefined4 __thiscall FUN_005bee80(int *param_1,uint param_2)



{

  uint *puVar1;

  uint *puVar2;

  undefined4 *puVar3;

  int iVar4;

  int iVar5;

  

  if ((uint)param_1[2] <= param_2) {

    if (param_2 <= (param_1[1] & 0x7fffffffU)) {

      return 1;

    }

    if (param_2 == 0) {

      FUN_005be620();

      return 1;

    }

    puVar2 = (uint *)thunk_FUN_005df0f5(param_2 * 0x10 + 4);

    if (puVar2 != (uint *)0x0) {

      puVar1 = puVar2 + 1;

      *puVar2 = param_2;

      FUN_00401000(puVar1,0x10,param_2,&LAB_005be4f0);

      if (puVar1 != (uint *)0x0) {

        if (*param_1 != 0) {

          iVar5 = param_1[2];

          if (-1 < iVar5 + -1) {

            puVar2 = puVar1 + (iVar5 + -1) * 4 + 2;

            do {

              iVar4 = *param_1 + (-8 - (int)puVar1);

              puVar2[-1] = *(uint *)((int)puVar2 + iVar4 + 4);

              *puVar2 = *(uint *)((int)puVar2 + iVar4 + 8);

              puVar2[1] = *(uint *)((int)puVar2 + iVar4 + 0xc);

              puVar2 = puVar2 + -4;

              iVar5 = iVar5 + -1;

            } while (iVar5 != 0);

          }

          if (((param_1[1] & 0x80000000U) == 0x80000000) && (iVar5 = *param_1, iVar5 != 0)) {

            iVar4 = *(int *)(iVar5 + -4);

            puVar3 = (undefined4 *)(iVar4 * 0x10 + iVar5);

            if (-1 < iVar4 + -1) {

              do {

                puVar3 = puVar3 + -4;

                iVar4 = iVar4 + -1;

                *puVar3 = &PTR_FUN_007a0acc;

              } while (iVar4 != 0);

            }

            operator_delete__((void *)(iVar5 + -4));

          }

        }

        *param_1 = (int)puVar1;

        param_1[1] = param_2 | 0x80000000;

        return 1;

      }

    }

  }

  return 0;

}





// --- FUN_005bef90 at 0x005BEF90 (size: 221) ---


undefined4 __fastcall FUN_005bef90(int *param_1)



{

  uint uVar1;

  uint *puVar2;

  undefined4 *puVar3;

  int iVar4;

  int iVar5;

  uint *puVar6;

  

  uVar1 = param_1[2];

  if (uVar1 == (param_1[1] & 0x7fffffffU)) {

    return 0;

  }

  if (uVar1 == 0) {

    puVar6 = (uint *)0x0;

LAB_005bf01c:

    if (((param_1[1] & 0x80000000U) == 0x80000000) && (iVar5 = *param_1, iVar5 != 0)) {

      iVar4 = *(int *)(iVar5 + -4);

      puVar3 = (undefined4 *)(iVar4 * 0x10 + iVar5);

      if (-1 < iVar4 + -1) {

        do {

          puVar3 = puVar3 + -4;

          iVar4 = iVar4 + -1;

          *puVar3 = &PTR_FUN_007a0acc;

        } while (iVar4 != 0);

      }

      operator_delete__((void *)(iVar5 + -4));

    }

    *param_1 = (int)puVar6;

    param_1[1] = param_1[2] | 0x80000000;

    return 1;

  }

  puVar2 = (uint *)thunk_FUN_005df0f5(uVar1 * 0x10 + 4);

  if (puVar2 != (uint *)0x0) {

    puVar6 = puVar2 + 1;

    *puVar2 = uVar1;

    FUN_00401000(puVar6,0x10,uVar1,&LAB_005be4f0);

    if (puVar6 != (uint *)0x0) {

      iVar5 = param_1[2];

      if (-1 < iVar5 + -1) {

        puVar2 = puVar6 + (iVar5 + -1) * 4 + 2;

        do {

          iVar4 = *param_1 + (-8 - (int)puVar6);

          puVar2[-1] = *(uint *)((int)puVar2 + iVar4 + 4);

          *puVar2 = *(uint *)((int)puVar2 + iVar4 + 8);

          puVar2[1] = *(uint *)((int)puVar2 + iVar4 + 0xc);

          puVar2 = puVar2 + -4;

          iVar5 = iVar5 + -1;

        } while (iVar5 != 0);

      }

      goto LAB_005bf01c;

    }

  }

  return 0;

}





// --- FUN_005bf070 at 0x005BF070 (size: 155) ---


uint __fastcall FUN_005bf070(int *param_1)



{

  uint uVar1;

  int iVar2;

  uint uVar3;

  uint *puVar4;

  uint *puVar5;

  

  uVar1 = param_1[2];

  uVar3 = param_1[1] & 0x7fffffff;

  if (uVar1 != uVar3) {

    if (uVar1 == 0) {

      puVar5 = (uint *)0x0;

LAB_005bf0d6:

      if (((param_1[1] & 0x80000000U) == 0x80000000) && (*param_1 != 0)) {

        operator_delete__((void *)(*param_1 + -4));

      }

      *param_1 = (int)puVar5;

      param_1[1] = param_1[2] | 0x80000000U;

      return CONCAT31((int3)((param_1[2] | 0x80000000U) >> 8),1);

    }

    puVar4 = (uint *)thunk_FUN_005df0f5(uVar1 * 4 + 4);

    uVar3 = 0;

    if (puVar4 != (uint *)0x0) {

      puVar5 = puVar4 + 1;

      *puVar4 = uVar1;

      uVar3 = FUN_00401000(puVar5,4,uVar1,FUN_0050a140);

      if (puVar5 != (uint *)0x0) {

        iVar2 = param_1[2] + -1;

        while (-1 < iVar2) {

          puVar4[iVar2 + 1] = *(uint *)(*param_1 + 4 + (iVar2 + -1) * 4);

          iVar2 = iVar2 + -1;

        }

        goto LAB_005bf0d6;

      }

    }

  }

  return uVar3 & 0xffffff00;

}





// --- FUN_005bf110 at 0x005BF110 (size: 279) ---


uint __fastcall FUN_005bf110(int *param_1)



{

  uint uVar1;

  uint *puVar2;

  int iVar3;

  undefined4 *puVar4;

  int iVar5;

  uint *local_4;

  

  uVar1 = param_1[2];

  if (uVar1 == (param_1[1] & 0x7fffffffU)) {

    return param_1[1] & 0x7fffff00;

  }

  if (uVar1 != 0) {

    puVar2 = (uint *)thunk_FUN_005df0f5(uVar1 * 0x3c + 4);

    if (puVar2 != (uint *)0x0) {

      local_4 = puVar2 + 1;

      *puVar2 = uVar1;

      FUN_00401000(local_4,0x3c,uVar1,FUN_005beb20);

      if (local_4 != (uint *)0x0) {

        iVar3 = param_1[2];

        if (-1 < iVar3 + -1) {

          puVar2 = local_4 + (iVar3 + -1) * 0xf + 2;

          do {

            iVar5 = *param_1 + (-8 - (int)local_4);

            puVar2[-1] = *(uint *)((int)puVar2 + iVar5 + 4);

            *(undefined1 *)puVar2 = *(undefined1 *)((int)puVar2 + iVar5 + 8);

            puVar2[1] = *(uint *)((int)puVar2 + iVar5 + 0xc);

            FUN_005ad300((undefined1 *)((int)puVar2 + iVar5 + 0x10));

            puVar2 = puVar2 + -0xf;

            iVar3 = iVar3 + -1;

          } while (iVar3 != 0);

        }

        goto LAB_005bf1c1;

      }

    }

    return 0;

  }

  local_4 = (uint *)0x0;

LAB_005bf1c1:

  if (((param_1[1] & 0x80000000U) == 0x80000000) && (iVar3 = *param_1, iVar3 != 0)) {

    iVar5 = *(int *)(iVar3 + -4);

    puVar4 = (undefined4 *)(iVar5 * 0x3c + iVar3);

    if (-1 < iVar5 + -1) {

      do {

        puVar4 = puVar4 + -0xf;

        *puVar4 = &PTR_FUN_007a0ad0;

        FUN_005aca00();

        iVar5 = iVar5 + -1;

      } while (iVar5 != 0);

    }

    operator_delete__((void *)(iVar3 + -4));

  }

  *param_1 = (int)local_4;

  param_1[1] = param_1[2] | 0x80000000U;

  return CONCAT31((int3)((param_1[2] | 0x80000000U) >> 8),1);

}





// --- FUN_005bf230 at 0x005BF230 (size: 305) ---


uint __fastcall FUN_005bf230(int *param_1)



{

  uint uVar1;

  uint *puVar2;

  int iVar3;

  undefined4 *puVar4;

  int iVar5;

  uint *local_8;

  

  uVar1 = param_1[2];

  if (uVar1 == (param_1[1] & 0x7fffffffU)) {

    return param_1[1] & 0x7fffff00;

  }

  if (uVar1 != 0) {

    puVar2 = (uint *)thunk_FUN_005df0f5(uVar1 * 100 + 4);

    if (puVar2 != (uint *)0x0) {

      local_8 = puVar2 + 1;

      *puVar2 = uVar1;

      FUN_00401000(local_8,100,uVar1,FUN_005bebd0);

      if (local_8 != (uint *)0x0) {

        iVar3 = param_1[2];

        if (-1 < iVar3 + -1) {

          puVar2 = local_8 + (iVar3 + -1) * 0x19 + 2;

          do {

            iVar5 = *param_1 + -(int)local_8 + -8;

            puVar2[-1] = *(uint *)((int)puVar2 + *param_1 + -(int)local_8 + -4);

            *puVar2 = *(uint *)((int)puVar2 + iVar5 + 8);

            FUN_005ad300((int)puVar2 + iVar5 + 0xc);

            FUN_005ad300((int)puVar2 + iVar5 + 0x38);

            puVar2 = puVar2 + -0x19;

            iVar3 = iVar3 + -1;

          } while (iVar3 != 0);

        }

        goto LAB_005bf2f6;

      }

    }

    return 0;

  }

  local_8 = (uint *)0x0;

LAB_005bf2f6:

  if (((param_1[1] & 0x80000000U) == 0x80000000) && (iVar3 = *param_1, iVar3 != 0)) {

    iVar5 = *(int *)(iVar3 + -4);

    puVar4 = (undefined4 *)(iVar5 * 100 + iVar3);

    if (-1 < iVar5 + -1) {

      do {

        puVar4 = puVar4 + -0x19;

        *puVar4 = &PTR_FUN_007a0ad4;

        FUN_005aca00();

        FUN_005aca00();

        iVar5 = iVar5 + -1;

      } while (iVar5 != 0);

    }

    operator_delete__((void *)(iVar3 + -4));

  }

  *param_1 = (int)local_8;

  param_1[1] = param_1[2] | 0x80000000;

  return CONCAT31((int3)((uint)local_8 >> 8),1);

}





// --- FUN_005bf370 at 0x005BF370 (size: 263) ---


uint __fastcall FUN_005bf370(int *param_1)



{

  uint uVar1;

  uint *puVar2;

  int iVar3;

  undefined4 *puVar4;

  int iVar5;

  uint *local_4;

  

  uVar1 = param_1[2];

  if (uVar1 == (param_1[1] & 0x7fffffffU)) {

    return param_1[1] & 0x7fffff00;

  }

  if (uVar1 != 0) {

    puVar2 = (uint *)thunk_FUN_005df0f5(uVar1 * 0x34 + 4);

    if (puVar2 != (uint *)0x0) {

      local_4 = puVar2 + 1;

      *puVar2 = uVar1;

      FUN_00401000(local_4,0x34,uVar1,FUN_005bec80);

      if (local_4 != (uint *)0x0) {

        iVar3 = param_1[2];

        if (-1 < iVar3 + -1) {

          puVar2 = local_4 + (iVar3 + -1) * 0xd + 2;

          do {

            iVar5 = *param_1 + (-8 - (int)local_4);

            puVar2[-1] = *(uint *)((int)puVar2 + iVar5 + 4);

            FUN_005ad300((int)puVar2 + iVar5 + 8);

            puVar2 = puVar2 + -0xd;

            iVar3 = iVar3 + -1;

          } while (iVar3 != 0);

        }

        goto LAB_005bf415;

      }

    }

    return 0;

  }

  local_4 = (uint *)0x0;

LAB_005bf415:

  if (((param_1[1] & 0x80000000U) == 0x80000000) && (iVar3 = *param_1, iVar3 != 0)) {

    iVar5 = *(int *)(iVar3 + -4);

    puVar4 = (undefined4 *)(iVar5 * 0x34 + iVar3);

    if (-1 < iVar5 + -1) {

      do {

        puVar4 = puVar4 + -0xd;

        *puVar4 = &PTR_LAB_007a0ad8;

        FUN_005aca00();

        iVar5 = iVar5 + -1;

      } while (iVar5 != 0);

    }

    operator_delete__((void *)(iVar3 + -4));

  }

  *param_1 = (int)local_4;

  param_1[1] = param_1[2] | 0x80000000U;

  return CONCAT31((int3)((param_1[2] | 0x80000000U) >> 8),1);

}





// --- FUN_005bf480 at 0x005BF480 (size: 123) ---


undefined4 __fastcall FUN_005bf480(int *param_1)



{

  uint uVar1;

  int iVar2;

  int iVar3;

  

  uVar1 = param_1[2];

  if (uVar1 == (param_1[1] & 0x7fffffffU)) {

    return 0;

  }

  if (uVar1 == 0) {

    iVar2 = 0;

  }

  else {

    iVar2 = thunk_FUN_005df0f5(uVar1 * 4);

    if (iVar2 == 0) {

      return 0;

    }

    iVar3 = param_1[2] + -1;

    while (-1 < iVar3) {

      iVar3 = iVar3 + -1;

      *(undefined4 *)(iVar2 + 4 + iVar3 * 4) = *(undefined4 *)(*param_1 + 4 + iVar3 * 4);

    }

  }

  if ((param_1[1] & 0x80000000U) == 0x80000000) {

    operator_delete__((void *)*param_1);

  }

  *param_1 = iVar2;

  param_1[1] = param_1[2] | 0x80000000;

  return 1;

}





// --- FUN_005bf560 at 0x005BF560 (size: 240) ---


void __fastcall FUN_005bf560(int *param_1)



{

  undefined4 *puVar1;

  uint uVar2;

  int iVar3;

  undefined4 local_40;

  undefined4 local_3c;

  undefined4 local_38;

  undefined4 local_34;

  undefined4 local_c;

  undefined4 local_8;

  undefined4 local_4;

  

  param_1[2] = 0;

  if ((param_1[1] & 0x80000000U) != 0x80000000) {

    if (*param_1 != 0) {

      uVar2 = param_1[1] & 0x7fffffff;

      if (-1 < (int)(uVar2 - 1)) {

        iVar3 = (uVar2 - 1) * 0x48;

        do {

          local_40 = 0x3f800000;

          local_3c = 0;

          local_38 = 0;

          local_34 = 0;

          local_c = 0;

          local_8 = 0;

          local_4 = 0;

          FUN_00535b30();

          *(undefined4 *)(*param_1 + iVar3 + 4) = 0;

          FUN_00425f10(&local_40);

          iVar3 = iVar3 + -0x48;

          uVar2 = uVar2 - 1;

        } while (uVar2 != 0);

      }

    }

    return;

  }

  puVar1 = (undefined4 *)*param_1;

  if (puVar1 != (undefined4 *)0x0) {

    if (puVar1[-1] != 0) {

      (**(code **)*puVar1)(3);

      *param_1 = 0;

      param_1[1] = 0;

      return;

    }

    operator_delete__(puVar1 + -1);

  }

  *param_1 = 0;

  param_1[1] = 0;

  return;

}





// --- FUN_005bf650 at 0x005BF650 (size: 247) ---


void __fastcall FUN_005bf650(int *param_1)



{

  undefined4 uVar1;

  uint uVar2;

  int iVar3;

  undefined4 *puVar4;

  int iVar5;

  undefined1 local_2c [44];

  

  param_1[2] = 0;

  if ((param_1[1] & 0x80000000U) != 0x80000000) {

    if (*param_1 != 0) {

      uVar2 = param_1[1] & 0x7fffffff;

      if (-1 < (int)(uVar2 - 1)) {

        iVar5 = (uVar2 - 1) * 0x3c;

        do {

          uVar1 = DAT_008f0874;

          FUN_005ac9c0();

          iVar3 = *param_1 + iVar5;

          *(undefined4 *)(iVar3 + 4) = uVar1;

          *(undefined1 *)(iVar3 + 8) = 0;

          *(undefined4 *)(iVar3 + 0xc) = uVar1;

          FUN_005ad300(local_2c);

          FUN_005aca00();

          iVar5 = iVar5 + -0x3c;

          uVar2 = uVar2 - 1;

        } while (uVar2 != 0);

      }

    }

    return;

  }

  iVar5 = *param_1;

  if (iVar5 != 0) {

    iVar3 = *(int *)(iVar5 + -4);

    puVar4 = (undefined4 *)(iVar3 * 0x3c + iVar5);

    if (-1 < iVar3 + -1) {

      do {

        puVar4 = puVar4 + -0xf;

        *puVar4 = &PTR_FUN_007a0ad0;

        FUN_005aca00();

        iVar3 = iVar3 + -1;

      } while (iVar3 != 0);

    }

    operator_delete__((void *)(iVar5 + -4));

  }

  *param_1 = 0;

  param_1[1] = 0;

  return;

}





// --- FUN_005bf750 at 0x005BF750 (size: 270) ---


void __fastcall FUN_005bf750(int *param_1)



{

  undefined4 uVar1;

  uint uVar2;

  undefined4 *puVar3;

  int iVar4;

  int iVar5;

  undefined1 local_58 [44];

  undefined1 local_2c [44];

  

  param_1[2] = 0;

  if ((param_1[1] & 0x80000000U) != 0x80000000) {

    if (*param_1 != 0) {

      uVar2 = param_1[1] & 0x7fffffff;

      if (-1 < (int)(uVar2 - 1)) {

        iVar5 = (uVar2 - 1) * 100;

        do {

          uVar1 = DAT_008f0874;

          FUN_005ac9c0();

          FUN_005ac9c0();

          iVar4 = *param_1;

          *(undefined4 *)(iVar4 + iVar5 + 4) = uVar1;

          *(undefined4 *)(iVar4 + iVar5 + 8) = uVar1;

          FUN_005ad300(local_58);

          FUN_005ad300(local_2c);

          FUN_005aca00();

          FUN_005aca00();

          iVar5 = iVar5 + -100;

          uVar2 = uVar2 - 1;

        } while (uVar2 != 0);

      }

    }

    return;

  }

  iVar5 = *param_1;

  if (iVar5 != 0) {

    iVar4 = *(int *)(iVar5 + -4);

    puVar3 = (undefined4 *)(iVar4 * 100 + iVar5);

    if (-1 < iVar4 + -1) {

      do {

        puVar3 = puVar3 + -0x19;

        *puVar3 = &PTR_FUN_007a0ad4;

        FUN_005aca00();

        FUN_005aca00();

        iVar4 = iVar4 + -1;

      } while (iVar4 != 0);

    }

    operator_delete__((void *)(iVar5 + -4));

  }

  *param_1 = 0;

  param_1[1] = 0;

  return;

}





// --- FUN_005bf860 at 0x005BF860 (size: 225) ---


void __fastcall FUN_005bf860(int *param_1)



{

  undefined4 uVar1;

  uint uVar2;

  int iVar3;

  undefined4 *puVar4;

  int iVar5;

  undefined1 local_2c [44];

  

  param_1[2] = 0;

  if ((param_1[1] & 0x80000000U) != 0x80000000) {

    if (*param_1 != 0) {

      uVar2 = param_1[1] & 0x7fffffff;

      if (-1 < (int)(uVar2 - 1)) {

        iVar5 = (uVar2 - 1) * 0x34;

        do {

          uVar1 = DAT_008f0874;

          FUN_005ac9c0();

          *(undefined4 *)(*param_1 + iVar5 + 4) = uVar1;

          FUN_005ad300(local_2c);

          FUN_005aca00();

          iVar5 = iVar5 + -0x34;

          uVar2 = uVar2 - 1;

        } while (uVar2 != 0);

      }

    }

    return;

  }

  iVar5 = *param_1;

  if (iVar5 != 0) {

    iVar3 = *(int *)(iVar5 + -4);

    puVar4 = (undefined4 *)(iVar3 * 0x34 + iVar5);

    if (-1 < iVar3 + -1) {

      do {

        puVar4 = puVar4 + -0xd;

        *puVar4 = &PTR_LAB_007a0ad8;

        FUN_005aca00();

        iVar3 = iVar3 + -1;

      } while (iVar3 != 0);

    }

    operator_delete__((void *)(iVar5 + -4));

  }

  *param_1 = 0;

  param_1[1] = 0;

  return;

}





// --- FUN_005bf950 at 0x005BF950 (size: 44) ---


undefined4 * __fastcall FUN_005bf950(undefined4 *param_1)



{

  LONG *lpAddend;

  

  *param_1 = &PTR_LAB_007e87ac;

  lpAddend = (LONG *)(PTR_DAT_00818344 + -0x10);

  param_1[1] = PTR_DAT_00818344;

  InterlockedIncrement(lpAddend);

  param_1[2] = 0;

  param_1[3] = 0;

  param_1[4] = 0;

  return param_1;

}





// --- FUN_005bf980 at 0x005BF980 (size: 92) ---


void __fastcall FUN_005bf980(undefined4 *param_1)



{

  LONG LVar1;

  undefined4 *puVar2;

  

  *param_1 = &PTR_LAB_007e87ac;

  if (((param_1[3] & 0x80000000) == 0x80000000) &&

     (puVar2 = (undefined4 *)param_1[2], puVar2 != (undefined4 *)0x0)) {

    if (puVar2[-1] == 0) {

      operator_delete__(puVar2 + -1);

    }

    else {

      (**(code **)*puVar2)(3);

    }

  }

  puVar2 = (undefined4 *)(param_1[1] + -0x14);

  LVar1 = InterlockedDecrement((LONG *)(param_1[1] + -0x10));

  if ((LVar1 == 0) && (puVar2 != (undefined4 *)0x0)) {

    (**(code **)*puVar2)(1);

  }

  return;

}





// --- FUN_005bf9e0 at 0x005BF9E0 (size: 50) ---


undefined4 * __fastcall FUN_005bf9e0(undefined4 *param_1)



{

  LONG *lpAddend;

  

  *param_1 = &PTR_FUN_007a0ec0;

  lpAddend = (LONG *)(PTR_DAT_00818344 + -0x10);

  param_1[1] = PTR_DAT_00818344;

  InterlockedIncrement(lpAddend);

  param_1[2] = DAT_008f0874;

  param_1[3] = DAT_008f0874;

  return param_1;

}





// --- FUN_005bfa20 at 0x005BFA20 (size: 108) ---


undefined4 * __thiscall FUN_005bfa20(undefined4 *param_1,int param_2)



{

  int iVar1;

  LONG LVar2;

  LONG *lpAddend;

  

  *param_1 = &PTR_FUN_007a0ec0;

  lpAddend = (LONG *)(PTR_DAT_00818344 + -0x10);

  param_1[1] = PTR_DAT_00818344;

  InterlockedIncrement(lpAddend);

  param_1[2] = *(undefined4 *)(param_2 + 8);

  param_1[3] = *(undefined4 *)(param_2 + 0xc);

  iVar1 = param_1[1];

  if (iVar1 != *(int *)(param_2 + 4)) {

    LVar2 = InterlockedDecrement((LONG *)(iVar1 + -0x10));

    if ((LVar2 == 0) && ((undefined4 *)(iVar1 + -0x14) != (undefined4 *)0x0)) {

      (*(code *)**(undefined4 **)(iVar1 + -0x14))(1);

    }

    iVar1 = *(int *)(param_2 + 4);

    param_1[1] = iVar1;

    InterlockedIncrement((LONG *)(iVar1 + -0x10));

  }

  return param_1;

}





// --- FUN_005bfa90 at 0x005BFA90 (size: 83) ---


undefined4 * __fastcall FUN_005bfa90(undefined4 *param_1)



{

  undefined4 uVar1;

  LONG *lpAddend;

  

  *param_1 = &PTR_LAB_007a0ec8;

  lpAddend = (LONG *)(PTR_DAT_00818344 + -0x10);

  param_1[1] = PTR_DAT_00818344;

  InterlockedIncrement(lpAddend);

  uVar1 = DAT_008f0874;

  param_1[3] = 0;

  param_1[4] = 0;

  param_1[5] = 0;

  param_1[6] = 0;

  param_1[7] = 0;

  param_1[8] = 0;

  param_1[9] = 0;

  param_1[2] = uVar1;

  param_1[10] = 0;

  param_1[0xb] = 0;

  param_1[0xc] = 0;

  param_1[0xd] = 0;

  param_1[0xe] = 0;

  param_1[0xf] = 0;

  return param_1;

}





// --- FUN_005bfaf0 at 0x005BFAF0 (size: 166) ---


int * __thiscall FUN_005bfaf0(int *param_1,uint *param_2)



{

  char cVar1;

  uint uVar2;

  int iVar3;

  uint uVar4;

  undefined4 *puVar5;

  int iVar6;

  

  if ((param_1[1] & 0x7fffffffU) < (param_2[1] & 0x7fffffff)) {

    param_1[2] = 0;

    cVar1 = FUN_005bee80(param_2[1] & 0x7fffffff);

    if (cVar1 == '\0') {

      return param_1;

    }

  }

  uVar2 = *param_2;

  uVar4 = param_2[2] * 0x10 + uVar2;

  if (uVar2 < uVar4) {

    puVar5 = (undefined4 *)(*param_1 + 8);

    do {

      puVar5[-1] = *(undefined4 *)(uVar2 + 4);

      *puVar5 = *(undefined4 *)(uVar2 + 8);

      puVar5[1] = *(undefined4 *)(uVar2 + 0xc);

      uVar2 = uVar2 + 0x10;

      puVar5 = puVar5 + 4;

    } while (uVar2 < uVar4);

  }

  uVar2 = param_2[2];

  if (uVar2 < (uint)param_1[2]) {

    iVar6 = uVar2 << 4;

    do {

      iVar3 = *param_1 + iVar6;

      *(undefined4 *)(iVar3 + 4) = 0;

      *(undefined4 *)(iVar3 + 8) = 0;

      *(undefined4 *)(iVar3 + 0xc) = 0;

      uVar2 = uVar2 + 1;

      iVar6 = iVar6 + 0x10;

    } while (uVar2 < (uint)param_1[2]);

  }

  param_1[2] = param_2[2];

  return param_1;

}





// --- FUN_005bfba0 at 0x005BFBA0 (size: 125) ---


int * __thiscall FUN_005bfba0(int *param_1,int *param_2)



{

  undefined4 *puVar1;

  char cVar2;

  undefined4 *puVar3;

  uint uVar4;

  undefined4 *puVar5;

  

  if ((param_1[1] & 0x7fffffffU) < (param_2[1] & 0x7fffffffU)) {

    param_1[2] = 0;

    cVar2 = FUN_00415910(param_2[1] & 0x7fffffff);

    if (cVar2 == '\0') {

      return param_1;

    }

  }

  puVar3 = (undefined4 *)*param_2;

  puVar1 = puVar3 + param_2[2];

  puVar5 = (undefined4 *)*param_1;

  for (; puVar3 < puVar1; puVar3 = puVar3 + 1) {

    *puVar5 = *puVar3;

    puVar5 = puVar5 + 1;

  }

  uVar4 = param_2[2];

  if (uVar4 < (uint)param_1[2]) {

    do {

      *(int **)(*param_1 + uVar4 * 4) = param_2;

      uVar4 = uVar4 + 1;

    } while (uVar4 < (uint)param_1[2]);

  }

  param_1[2] = param_2[2];

  return param_1;

}





// --- FUN_005bfc20 at 0x005BFC20 (size: 198) ---


void * __thiscall FUN_005bfc20(void *param_1,byte param_2)



{

  LONG LVar1;

  undefined4 *puVar2;

  undefined4 *puVar3;

  int local_4;

  

  if ((param_2 & 2) == 0) {

    FUN_005bf980();

    if ((param_2 & 1) != 0) {

      operator_delete(param_1);

    }

    return param_1;

  }

  local_4 = *(int *)((int)param_1 + -4);

  puVar3 = (undefined4 *)((int)param_1 + local_4 * 0x14);

  if (-1 < local_4 + -1) {

    do {

      puVar3[-5] = &PTR_LAB_007e87ac;

      if (((puVar3[-2] & 0x80000000) == 0x80000000) &&

         (puVar2 = (undefined4 *)puVar3[-3], puVar2 != (undefined4 *)0x0)) {

        if (puVar2[-1] == 0) {

          operator_delete__(puVar2 + -1);

        }

        else {

          (**(code **)*puVar2)(3);

        }

      }

      puVar2 = (undefined4 *)(puVar3[-4] + -0x14);

      LVar1 = InterlockedDecrement((LONG *)(puVar3[-4] + -0x10));

      if ((LVar1 == 0) && (puVar2 != (undefined4 *)0x0)) {

        (**(code **)*puVar2)(1);

      }

      local_4 = local_4 + -1;

      puVar3 = puVar3 + -5;

    } while (local_4 != 0);

  }

  if ((param_2 & 1) != 0) {

    operator_delete__((void *)((int)param_1 + -4));

  }

  return (void *)((int)param_1 + -4);

}





// --- FUN_005bfcf0 at 0x005BFCF0 (size: 290) ---


undefined4 __thiscall FUN_005bfcf0(int *param_1,uint param_2)



{

  uint *puVar1;

  int iVar2;

  undefined4 *puVar3;

  uint uVar4;

  uint *puVar5;

  

  uVar4 = param_2;

  if ((uint)param_1[2] <= param_2) {

    if (param_2 <= (param_1[1] & 0x7fffffffU)) {

      return 1;

    }

    if (param_2 == 0) {

      FUN_005bf560();

      return 1;

    }

    puVar5 = (uint *)thunk_FUN_005df0f5(param_2 * 0x48 + 4);

    if (puVar5 != (uint *)0x0) {

      puVar1 = puVar5 + 1;

      *puVar5 = param_2;

      FUN_00401000(puVar1,0x48,param_2,FUN_00424d10);

      if (puVar1 != (uint *)0x0) {

        if (*param_1 != 0) {

          param_2 = param_1[2];

          if (-1 < (int)(param_2 + -1)) {

            puVar5 = puVar5 + (param_2 + -1) * 0x12 + 3;

            do {

              iVar2 = *param_1;

              puVar5[-1] = *(uint *)((int)puVar5 + iVar2 + -(int)puVar1 + -4);

              FUN_00425f10((int)puVar5 + iVar2 + -(int)puVar1);

              puVar5 = puVar5 + -0x12;

              param_2 = param_2 + -1;

            } while (param_2 != 0);

          }

          if (((param_1[1] & 0x80000000U) == 0x80000000) &&

             (puVar3 = (undefined4 *)*param_1, puVar3 != (undefined4 *)0x0)) {

            if (puVar3[-1] != 0) {

              (**(code **)*puVar3)(3);

              *param_1 = (int)puVar1;

              param_1[1] = uVar4 | 0x80000000;

              return 1;

            }

            operator_delete__(puVar3 + -1);

          }

        }

        *param_1 = (int)puVar1;

        param_1[1] = uVar4 | 0x80000000;

        return 1;

      }

    }

  }

  return 0;

}





// --- FUN_005bfe20 at 0x005BFE20 (size: 310) ---


undefined4 __thiscall FUN_005bfe20(int *param_1,uint param_2)



{

  uint *puVar1;

  int iVar2;

  uint uVar3;

  uint *puVar4;

  int iVar5;

  undefined4 *puVar6;

  

  uVar3 = param_2;

  if ((uint)param_1[2] <= param_2) {

    if (param_2 <= (param_1[1] & 0x7fffffffU)) {

      return 1;

    }

    if (param_2 == 0) {

      FUN_005bf650();

      return 1;

    }

    puVar4 = (uint *)thunk_FUN_005df0f5(param_2 * 0x3c + 4);

    if (puVar4 != (uint *)0x0) {

      puVar1 = puVar4 + 1;

      *puVar4 = param_2;

      FUN_00401000(puVar1,0x3c,param_2,FUN_005beb20);

      if (puVar1 != (uint *)0x0) {

        if (*param_1 != 0) {

          iVar5 = param_1[2];

          if (-1 < iVar5 + -1) {

            puVar4 = puVar1 + (iVar5 + -1) * 0xf + 2;

            do {

              iVar2 = *param_1 + (-8 - (int)puVar1);

              puVar4[-1] = *(uint *)((int)puVar4 + iVar2 + 4);

              *(undefined1 *)puVar4 = *(undefined1 *)((int)puVar4 + iVar2 + 8);

              puVar4[1] = *(uint *)((int)puVar4 + iVar2 + 0xc);

              FUN_005ad300((undefined1 *)((int)puVar4 + iVar2 + 0x10));

              puVar4 = puVar4 + -0xf;

              iVar5 = iVar5 + -1;

            } while (iVar5 != 0);

          }

          if (((param_1[1] & 0x80000000U) == 0x80000000) && (iVar5 = *param_1, iVar5 != 0)) {

            param_2 = *(int *)(iVar5 + -4);

            puVar6 = (undefined4 *)(param_2 * 0x3c + iVar5);

            if (-1 < (int)(param_2 + -1)) {

              do {

                puVar6 = puVar6 + -0xf;

                *puVar6 = &PTR_FUN_007a0ad0;

                FUN_005aca00();

                param_2 = param_2 + -1;

              } while (param_2 != 0);

            }

            operator_delete__((void *)(iVar5 + -4));

          }

        }

        *param_1 = (int)puVar1;

        param_1[1] = uVar3 | 0x80000000;

        return 1;

      }

    }

  }

  return 0;

}





// --- FUN_005bff60 at 0x005BFF60 (size: 200) ---


undefined4 __thiscall FUN_005bff60(int *param_1,uint param_2)



{

  uint *puVar1;

  uint uVar2;

  uint *puVar3;

  int iVar4;

  

  uVar2 = param_2;

  if ((uint)param_1[2] <= param_2) {

    if (param_2 <= (param_1[1] & 0x7fffffffU)) {

      return 1;

    }

    if (param_2 == 0) {

      FUN_005bf750();

      return 1;

    }

    puVar3 = (uint *)thunk_FUN_005df0f5(param_2 * 100 + 4);

    if (puVar3 != (uint *)0x0) {

      puVar1 = puVar3 + 1;

      *puVar3 = param_2;

      FUN_00401000(puVar1,100,param_2,FUN_005bebd0);

      if (puVar1 != (uint *)0x0) {

        if (*param_1 != 0) {

          param_2 = param_1[2];

          if (-1 < (int)(param_2 + -1)) {

            iVar4 = (param_2 + -1) * 100;

            do {

              FUN_005be5e0(*param_1 + iVar4);

              iVar4 = iVar4 + -100;

              param_2 = param_2 + -1;

            } while (param_2 != 0);

          }

          if (((param_1[1] & 0x80000000U) == 0x80000000) && (*param_1 != 0)) {

            FUN_0047cfb0(3);

          }

        }

        *param_1 = (int)puVar1;

        param_1[1] = uVar2 | 0x80000000;

        return 1;

      }

    }

  }

  return 0;

}





